Spend Management Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
NMZ
Associate
Associate
295

In this blog, you will learn how to set up a custom process that you have developed yourself in SAP Build Process Automation and that you want to run within SAP Ariba Intake Management.

Setting up a request type

When setting up a new request type in SAP Ariba Intake Management (see Configuring Intake Request Types), it is possible to integrate two kinds of processes:

Pre-delivered Processes

These processes run in the SAP-managed customer subaccount. These process are restricted in their access since the customers and partners cannot access the subaccount that is managed by SAP.  Customers or partners can run the pre-delivered process as it has been delivered. Only if SAP delivers variants of the process, can the customer or partner make modification. The ability to modify the variant will depend if SAP has exposed any SAP Build Process Automation (SBPA) artefacts for editing.

Custom Processes

Custom Processes run in the customer managed subaccount owned by the customer (or managed on behalf of a partner). Customers and partners can view or modify the process in the SAP Build Process Automation process editor. Moreover, they can develop new ones. Note however, that SAP does not provide any maintenance or support for customer managed processes. SAP delivers an example process per default (“Return Item”) as a template for a typical custom process.

Make a custom process available in configuration app “Configure Intake Request Types”

Follow the documentation on Connecting your own SAP Build ProcessAutomation Instance and creating your own Processes for SAP Ari...

Before you can start to develop your own SBPA processes and deploy them, you must set up and connect your customer managed SBPA instance and connect it to SAP Ariba Intake Management. The essential steps on how to set up destinations and relationships to SAP Cloud Identity services are described in Connecting Your Own SAP Build Process Automation Instance.

Once the customer managed SBPA instance is connected to intake management, you can create a new request type by clicking on configuration -> Configure Intake Request Types -> Create. In the new request type select “Custom Process” and then choose your process Id from the value help and maintain the URL of the Application. Maintain all other mandatory fields and save the request type.

We assume that a custom process is started via a Fiori UI and that the process defined in SBPA includes a start trigger. Intake Management will not automatically notice if a new SBPA process instance has been created. To ensure that the intake process instances become visible on the Intake Dashboard, the direct call of the trigger must be re-routed via the intake core service. The intake core service will start the SBPA process and persist a link to the process instance. This way the new process instance will also be displayed in the intake dashboard. To achieve this, the intake core service offers an API. This API needs to be called from your UI5 Application.

The URL can be constructed from:

  • The application name you have used to deploy your UI5 application. You can find it in your customer managed subaccount, in the BTP-Cockpit under “HTML5 Applications” in the column “Application Name”. (referred to as “<your HTML5 app name>” in the example code below)

  • The API path “/intake-api/api/Intake/v1/
  • The action name “startIntake”

The following code snippets show how the start of an SBPA process can be triggered via the intake core service. The assumption is, that this code is part of an UI5 App, deployed in a customer managed subaccount. To make the code below work, the destination intake_api needs to be set up and a dependency to SAP Cloud Identity Services must be created, as described in the documentation linked above.

Provide the process parameters as parameters to your HTML5 App

If you have built your own SBPA process, this process may have parameters it can be started with. To reveal these parameters to the AI features of SAP Ariba Intake Management, they need to be sent into your HTML5 App as startup parameters. That way, if your process is being recommended by the AI as a request type, the AI can already prefill some or all related parameters from the conversation content with the end user. This way you can pre-populate fields with the values and the end user will have to fill in less information into your HTML5 App.

To take over the values from the startup parameters, follow the documentation on Deploying a UI in SAP Build Process Automation (Option 2).

startSbpaProcess: function () {
    var payload = {
    //extract the parameter intakeConfigurationID 
    //from the parameters your application has been started with.

    //the payloads ”Parameters” reflect the importing parameters 
    //of your SBPA process. Extract the according values from the parameters your 
    //application has been started with and merge it with the end users input
    IntakeConfigurationID: ”your intakeConfigurationID” ,
    IntakeInstanceID: "your intakeInstanceID") || null,
    Parameters: [
        {
          Name: "simpleValueName",
          Value: {value: "simpleValue"}
        },
        {
          Name: "structuredParameter",
          Value:
              {
                value: [
                    {
                        “member1”: valueOfMember1,
                        “member2”: valueOfMember2,
                        “member3”: valueOfMember3,
                    }
                ]
          }
        }
     ]
  };
  _startTheProcess(payload);
};

 

_startTheProcess: function (payload) {
    let sUrl = 
"<your HTML5 app name>/intake-api/api/Intake/v1/startIntake"; 
    // Make an AJAX POST request to initiate the workflow
      $.ajax({
        url: sUrl, 
        method: "POST", 
        async: false, 
        contentType: "application/json",
        },
        data: JSON.stringify(payload), 
        success: function (result) {
          console.info("started workflow:");
        },
        error: function (request) {
        // Parse and log the error response
          var errorResponse = JSON.parse(request.responseText);
          console.error("Error starting workflow:", errorResponse);
        }
    });
},

Further documentation on the API can be found on: