Show TOC

Procedure documentationStarting a Process with the BPM API Locate this document in the navigation structure

 

With the Business Process Management (BPM) application programming interfaces (APIs), you can customize and enhance the way you use business processes and execute tasks. This document describes how you start a deployed process using the BPM API. For a detailed description of the BPM public APIs, see http://help.sap.com/javadocs/.

Prerequisites

  • You have added the necessary dependencies to development component tc/bpem/facade/ear (public part api) in software component BPEM-FACADE and tc/je/sdo21/api in software component ENGFACADE.

Procedure

  1. Retrieve the ProcessDefinitionManager.

    Syntax Syntax

    1. ProcessDefinitionManager processDefinitionManager = BPMFactory.getProcessDefinitionManager();
    End of the code.
  2. Get the active process definition of a specified process deployed on the server.

    Syntax Syntax

    1. ProcessDefinition processDefinition = processDefinitionManager.getActiveProcessDefinition(VENDOR, DC_NAME, PROCESS_NAME);
    End of the code.
  3. Retrieve the ProcessStartManager.

    Syntax Syntax

    1. ProcessStartManager processStartManager = BPMFactory.getProcessStartManager();
    End of the code.
  4. Get the start event of the process definition.

    In the current version of SAP NetWeaver BPM, only one start event is supported for each active pool; therefore, the result will contain one element only.

    Syntax Syntax

    1. Set<ProcessStartEvent> processStartEvents = processStartManager.getProcessStartEvents(processDefinition.getId());
    2. ProcessStartEvent processStartEvent = processStartEvents.iterator().next();
    End of the code.
  5. Create a data object for the start event, adhering to the service interface definition assigned to the start event.

    Syntax Syntax

    1. DataObject processStartDataObject = processStartManager.createDataObjectForStartEvent(processStartEvent);
    End of the code.
  6. Fill in the data object with valid input data for the process.

    Syntax Syntax

    1. processStartDataObject.setString(processStartDataObject.getType().getProperty(FIELD_CUSTOMER), VALUE_CUSTOMER);
    End of the code.
  7. Start the process with the start event and the matching input data.

    The call returns the ID of the process instance that was just started.

    Syntax Syntax

    1. URI processInstanceId = processStartManager.startProcess(processStartEvent, processStartDataObject);
    End of the code.

Note Note

For conditional start processes, invocations of 'startProcess(...)' are rejected to avoid a multi match scenario through a manual start. For more information, see Conditional Start.

End of the note.

Result

You have started a deployed process by using the BPM API.

Caution Caution

For a correct behavior while executing the process at runtime, you have to configure the http.baseurl property. This configuration can be done in the SAP NetWeaver Administrator when you are logged with administrator rights. Choose   Configuration Management   Infrastructure   Java System Properties  . Then choose the Application tab and select the tc~bpem~base~ear application.

End of the caution.