SAP Business Workflow - Abap Classes


In SAP ABAP workbench, class builder is a tool in ABAP that allows you to define, change and test global ABAP classes and interfaces. Class Builder has two modes −

  • Form based mode
  • Source code based mode

With the use of IF_WORKFLOW Interface, you can use ABAP classes in SAP WebFlow Engine. In SAP system, a WebFlow Engine (SAP Business Workflow) is used to define and map the business processes, which are not mapped. It includes the release or approval processes and also complex processes such as creating a Purchase Order, etc. and different actions of the departments involved. SAP WebFlow Engine is mostly used for the processes, which are repeated in nature or involves actions from large number of agents in a predefined order.

A WebFlow Engine can also be used to handle errors in the existing processes and workflows. Using WebFlow Engine, you can also start a workflow when predefined events occur.

To use ABAP classes on Workflows, it is necessary to implement Interface IF_WORKFLOW in ABAP class. This interface includes method that creates specific prerequisites such that the object can be used within the SAP WebFlow Engine.

Interface IF_WORKFLOW contains the following methods −

  • BI_PERSISTENT~FIND_BY_LPOR
  • BI_PERSISTENT~REFRESH
  • BI_OBJECT~EXECUTE_DEFAULT_METHOD
  • BI_PERSISTENT~LPOR
  • BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE
  • BI_OBJECT~RELEASE

How to Add an IF_WORKFLOW in an ABAP Class?

To add an IF_WORKFLOW interface to a class, you have to open Class Builder T-Code: SE24.

IF_WORKFLOW

Go to the Interface tab, add the IF_WORKFLOW interface. Once you add this interface, it also adds two sub-interfaces: BI_OBJECT and BI_PERSISTENT. When you move to the Methods tab and you will see some methods of these interfaces have been automatically inherited to ABAP Class.

For a Utility class to implement IF_WORKFLOW interface, you need to open each of the methods inherited from the IF_WORKFLOW interface, and then activate the empty source code → activate the ABAP Class.

Note − When you implement IF_WORKFLOW interface in a class, it can be used in any of the workflows. An ABAP class is automatically released to be used with the implementation of this interface. You should only make compatibility changes after the implementation of the interface and shouldn’t remove attributes, type changes, or methods. In SAP system, it doesn’t define a list where it mentions that the class is in use in these workflows.

Also note that IF_WORKFLOW interface shouldn’t be implemented in internal classes of an application, as this would mean that each method of ABAP class can be used in the workflows.

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements