ABAP Classes in Workflow

...Previous

19.  BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE Method:

The BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE method returns the display name of the object.

Features:

We can display references to process objects or process step objects at different positions within the SAP WebFlow Engine (for example, in Business Workplace and in Workflow Log). The object key is normally displayed here. If, for example, we want to display a descriptive text instead, the BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE method has to return the corresponding value.

If the method does not contain implementation or does not return a value, the object key is displayed.

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method. 

There is an implementation example in the CL_SWF_FORMABSENC demo class. 

20.              BI_OBJECT~EXECUTE_DEFAULT_METHOD Method:

The BI_OBJECT~EXECUTE_DEFAULT_METHOD method is the standard method for the object. This method is executed when, for example, we call the object in Business Workplace.

Features:

We can display process objects or process step objects at different positions within the SAP WebFlow Engine (for example, in Business Workplace and in Workflow Log). The SAP WebFlow Engine calls the BI_OBJECT~EXECUTE_DEFAULT_METHOD method.

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method.

There is an implementation example in the CL_SWF_FORMABSENC demo class.

21.              BI_OBJECT~RELEASE Method:

The system indicates that the reference to the instance is no longer needed by using the BI_OBJECT~RELEASE method. This means we can delete the reference from instance management. Once the last reference has been deleted from instance management, the GARBAGE COLLECTOR can release the corresponding memory area. 

Features: 

If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method. 

There is an implementation example in the CL_SWF_FORMABSENC demo class. 

 

22.              How to use ABAP Classes in Process Steps of Business Workflow?

In process steps we can use methods and attributes of ABAP classes in the same way as methods and attributes of Business Object Repository (BOR) objects. We can call these methods in the process context. 

Features: 

While using the ABAP Classes in the Process Steps the methods may contain dialogs, they can be synchronous or asynchronous; they may appear in the workflow log, and so on. 

In general, we can use any method that is implemented as a public method. The method can be implemented in the class itself, in one of the super classes of the class, or by way of an interface. 

The maximum permitted length for methods that are implemented by way of an interface, for example IF_WORKFLOW~FIND_BY_LPOR, is 30 characters. If the method name is too long, we can choose a shorter name for the method by defining an alias. If the method is implemented in the class or in a super class, the name of the method cannot be longer than 30 characters, so this limitation does not apply. 

Parameters: 

We can assign values from the workflow container to the method parameters. Conversely, export parameters can be entered as workflow container values. The following overview shows how the individual types can be used as parameters: 

Ø      Simple types (string, integer, and so on)

Ø      Data Dictionary types (structures, tables, complex types)

Ø      References to objects from the Business Object Repository

Ø      References to ABAP classes (supporting the IF_WORKFLOW interface) 

We can transfer method parameters that represent a persistent object (IF_WORKFLOW or BOR Object) in the following ways: 

v     ABAP classes (with IF_WORKFLOW interface) 

§         TYPE SIBFLPORB

Object is transferred using the persistent display 

§         TYPE REF TO <Class name>

Object is transferred as object reference

v     BOR objects 

§         TYPE SIBFLPORB

Object is transferred using the persistent display 

§         TYPE SWOTOBJID

Object is transferred using the persistent display; this display is only valid for BOR objects 

§         TYPE SWC_OBJECT

Object is transferred as object reference 

Exceptions: 

The SAP WebFlow Engine can deal with exceptions that are triggered by the methods. It differentiates between application exceptions and temporary exceptions. The two exception categories are differentiated by the exception in the class hierarchy or by naming conventions. In the case of a temporary exception, the SAP WebFlow Engine attempts to execute the method again. In the case of a permanent error the status for the workflow is set to error.

Class-Based Exceptions: 

To create a temporary exception, we can use, for example, the CX_BO_TEMPORARY class or a corresponding subclass. It can be helpful to trigger an exception for dialog methods when the user cancels the dialog. Here, for example, we could trigger the CX_BO_ACTION_CANCELED exception (subclass of the CX_BO_TEMPORARY class).

Exceptions Not Based on Class: 

We can also trigger exceptions not based on class. The SAP WebFlow Engine can differentiate between the two exception categories (temporary and permanent) by the name. If the exception begins with TMP or TEMP, it is a temporary exception; otherwise it is a permanent exception.

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image