Sometimes it is more efficient to link BRF plus and SAP business workflow to establish close integration and simplify the rules for triggering workflows available. It should be clear to explain and maintain for an experienced SAP user.
There are two options to call SAP business workflow from BRF plus:
- starting workflow directly (WS*),
- triggering a workflow event.
In comparison to starting workflow directly, a workflow event can trigger several workflows based on the Linkage maintained ( transaction SWETYPV – Type Linkages ).
In this blog article, you can get a quick have a look at How to raise a Workflow event from BRF Plus.
It is assumed that a workflow scenario is already created for the ABAP class’s event. So the question is only how to call it from BRF plus.
In a test scenario, a test function WS_ATP_SIGNAL processes lines with available quantity for materials. As the input data, it receives a table to analyze the situation for availability for several materials using the set of predefined rules. The return parameter is Action as it is expected that during processing the function will run actions only.
In the assigned Rule set it is the Loop expression ‘ATP_LINES’ that processes each line of the input table and decides on the action. The action raises as an event for a workflow.
To link the Business workflow and BRF plus, create an expression with the type Raise Workflow Event (Action). In this example, it is WS_SEND_NOTIFICATION and WS_PIR_CREATION.
When the condition has been fulfilled the expression to raise and the workflow event will be executed.
Each expression will contain a Business workflow ABAP object ( it can be also a Business object ). In this example, it is the ABAP Class technique. Set the ABAP class and the event.
The ABAP class should contain Interface IF_WORKFLOW as the other class that is supposed for SAP Business workflow scenarios.
The object instance is used to create an instance of the class, it is needed to assign the key for the object. In this case, it is the combination of Plant and Material. The key can be built with a formula expression using the data objects (elements) from the function’s context.
- FDT_E_SIBFBORIID = CONCATENATE ( IT_LINES-PLANT, IT_LINES-MATERIAL ).
After setting ABAP class and Event, press the button to Update the container. It will read import data for the event and will propose the binding. ZBS_TS_ATPV_VIEW is the structure line of the input table from the function. The same type of structure is assigned to the event of the ABAP class.
When these prerequisites are fulfilled, the event will be raised during BRF plus function call or during BRF plus simulation with performing Actions. The event creation can be caught with a breakpoint in the FM SWW_WI_CREATE_VIA_EVENT_IBF.