Sometimes we need to call a workflow process from our SAP ABAP programs and implementations in an easy form with Object Oriented Programming capabilities, but many times we found SAP business workflow implementations are Business Object Oriented and this way is too tricky and old fashioned for us.
Good news! SAP Business Workflow allows to be called through our own Event-Class with our own parameters without create a Business Object Repository. This example shows a simple way to call a workflow process from Event-Class into a Class Method or SAP ABAP Program.
- Create a reference to SAP Business Interface in our class (trx SE24). With this way we are able to use our SAP ABAP Class into SAP Business Workflow Event Containers. Please add the interface parameters below:
2. Create our event with parameters compatible with our Workflow Input Parameters.
- EJECUTAR_WORKFLOW (Execute workflow): class event for launch our SAP Business Workflow.
- Event Parameters for EJECUTAR_WORKFLOW event.
3. Binding our SAP Business Workflow object template (trx PFCT) to be launched by our SAP ABAP Event Class in Triggering Events and activate it (Green Button indicates event activation).
- Select ABAP Object Class and click Call Binding Editor ( Button ) and Bind our Event Parameters with Workflow Parameters (and save).
4. Calling workflow from method-class. (Code Example).
- Get our Event Container Workflow (a reference to our event container parameters).
- Set workflow Variables for Event (setting variables one by one with our values for launch our SAP Business Workflow).
- Calling Workflow Event Class (Raise our Event with our parameters).
… And that’s all folks. With this way we can call our SAP Business Workflow from our SAP ABAP Class Method.