Skip to Content
Technical Articles
Author's profile photo Ashish Ahire

Trigger Build Process Automation Instance from S/4 HANA On-Premise using ABAP Code

This blog presents one of the approach for initiating SAP Build Process Automation from an S/4 Hana On-Premise system using ABAP code.

As you know, SAP Build Process Automation is the unified offering in SAP BTP that combines the capabilities of SAP Workflow Management and SAP Intelligent RPA and its staring point can be FORM or API.

You can read more on SAP Build Process Automation (here).

Prerequisite:

  1. Subscription of SAP Build process automation in BTP Trial Account
  2. S/4 Hana on-premise system with required access

To illustrate this, I have developed a sap build process which contain workflow rather than process automation, with its trigger point being an API.

Note: Numerous blogs and learning resources are readily available for SAP Build processes automation, which I won’t reiterate here.

I will use the abbreviation SBPA for referring to SAP Build Process Automation.

Steps to be performed on SAP BTP:

Step 1.  Creating simple build process for Employee and deploy.

It has a form which display essential information such as Epmid, Name, Department and Status. This information we receive from build process instance payload. After receiving the information, you can either approve or reject it to finalize the process.

SAP%20Build%20Process

SAP Build Process

Step 2. Please make a copy of the triggering point URL as it will be required to initiate the instance.

Trigger%20API%20Url

 

Steps to be performed on S/4 Hana on-premises system :

 

Step 1: Establish an SM59 Destination (type G) in your S/4 system to obtain an OAuth token for SAP Build process automation. This token will use in sub sequent request to initiate the instance.

You can get host/token URL, user name(client id) and password(client secret) from service key instance of SBPA.

 

Step 2 : Create ABAP class with 2 methods

a. Get oAuth token using destination

b. Trigger SBPA instance

You can get full code from my Github repo (SCN-Sample-Code)

 

Step 3 : Create sample SE38 program to test.

 

Lets execute it.

Upon successful initiation of the instance, you will receive the instance ID along with its corresponding status.

 

To verify the successful initiation, you can open the SBPA Monitor tab and check the work item in the Inbox app.

 

You can approve/reject to complete the process.

 

Conclusion : 

We have successfully triggered the SAP Build process from your S/4 HANA on-premise system using ABAP code. This approach can also be applied to trigger instances from BAdi instead of a custom program. Additionally, you can utilize the same approach to trigger other instances based on SAP BTP services.

Are you interested in getting to use more Low-Code/No-Code capabilities with SAP BTP?

Are you interested to keep your S/4 Hana core clean ?

Lets learn and share!

 

Regards,
Ashish

Assigned Tags

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

      excellent sharing

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      Hi Ashish Ahire,

      This is a good description of a technical approach for triggering an SAP Build Process Automation workflow from ABAP.  I would be interested to know in your experience, any examples of real business scenarios that have required implementation of this approach.

      Thanks,

      Mustafa.

      Author's profile photo Ashish Ahire
      Ashish Ahire
      Blog Post Author

      Hello Mustafa Bensan,

      I had a custom business process scenario related to procurement where workflow was getting started from ABAP and its steps were changed/completed based on 3rd party applications ( outside of sap ), There I have implemented this approach.

      BR,

      Ashish

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      Hi Ashish Ahire

      Thanks for the clarification.  So that sounds like a hybrid scenario where part of the business process is executed in the on-premise S/4HANA business workflow which then triggers the SBPA workflow for the 3rd-party via ABAP.  Have I understood correctly?

      Regards,

      Mustafa.

      Author's profile photo Saswata Chandra
      Saswata Chandra

      Hey Ashish,

      Intriguing write up but your GitHub repo isn't actually taking us to github. Could you please check and update?

       

      Author's profile photo Ashish Ahire
      Ashish Ahire
      Blog Post Author

      Hello Saswata Chandra ,

      Thanks for pointing, Please check again.

      Author's profile photo Ashish Ahire
      Ashish Ahire
      Blog Post Author

      Yes Mustafa Bensan

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      Ashish Ahire, does that mean you have 2 Inbox apps, one in the S/4HANA on-premise Launchpad and one in the SBPA Launchpad?

      Author's profile photo Ashish Ahire
      Ashish Ahire
      Blog Post Author

      Depends on scenario or you can use Task center.

      https://community.sap.com/topics/task-center/faq

       

       

      Author's profile photo Andol Abhilash
      Andol Abhilash

      Hi Ashish Ahire,

      This is great idea to trigger SAP Build Process Automation from S/4 Hana on premises using ABAP.

      I am trying to do the same using the steps you have given. I have created the destination when I test the connection I was getting the error. Can you please tell me how to add client id and client secret id (OAuth Authorization) in destination(sm59).

      Thanks,

      Abhilash