ABAP Classes in Workflow

...Previous

15.  Why IF_WORKFLOW Interface?

The IF_WORKFLOW interface is necessary when using an ABAP class within the SAP WebFlow Engine. The interface contains methods that allow the object to be used within the SAP WebFlow Engine.

The SAP WebFlow Engine handles all objects generically. Objects have to be saved in the event of a context change. Therefore, it is necessary to convert object references in such a way that they can be saved persistently. Conversely, we have to be able to generate the corresponding instance of an ABAP class from the persistently saved key.

There are also a number of SAP WebFlow Engine components, for example, the Workflow Log that can display objects. In this case the object has to provide corresponding functions.

The IF_WORKFLOW interface puts a logical parenthesis round the BI_PERSISTENT (instance management) and BI_OBJECT (object behavior) interfaces. The IF_WORKFLOW interface contains the following methods:

Ø       BI_PERSISTENT~FIND_BY_LPOR

Ø       BI_PERSISTENT~LPOR

Ø       BI_PERSISTENT~REFRESH

Ø       BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE

Ø       BI_OBJECT~EXECUTE_DEFAULT_METHOD

Ø       BI_OBJECT~RELEASE 

A class that implements the IF_WORKFLOW interface can be used in any workflow. The class is automatically released for use in workflows when the interface is implemented. Therefore, we can only make compatible changes to a class after implementation (we cannot delete attributes, change types or delete methods). There is no where-used list to show which workflows the class is used in. 

Internal classes of an application should not implement the IF_WORKFLOW interface, since this could mean that each method of the class is used in the workflow. Therefore, we should encapsulate the workflow functions in another class that calls the selected methods of the internal class. 

Each method of the IF_WORKFLOW Interface as mentioned earlier has its distinct functionality, which is discussed below.

16.    BI_PERSISTENT~FIND_BY_LPOR Method:

If we want to convert a persistent saved display of an object into an instance of the corresponding ABAP class, SAP Webflow Engine calls the BI_PERSISTENT~FIND_BY_LPOR method.

Features:

The method parameter LPOR is the persistent object reference and is of SIBFLPOR structure type. A reference of BI_PERSISTENT type is returned.

 

The following table shows the components of the SIBFLPOR structure:

 

Field

Description

CATID

Describes the object type ( CL for ABAP classes)

TYPEID

ABAP class name

INSTID

Object key. The key is limited to 32 characters.

 

We can implement this method in several ways. In the case of persistent classes we can create the ABAP object instance using the generated classes. In the case of individual persistence management we have to implement the individual actions (such as creating an instance, performing an existence check, entering public attributes, and so on) manually within the class.

 

Instance management takes place automatically in the case of persistent classes. In the case of individual persistence management we also have to carry out instance management by class. The SAP WebFlow Engine does not provide any instance management. We must therefore implement our own instance management in the case of individual persistence management.

 

The FIND_BY_LPOR method should always return the same instance if the following problems are to be avoided: 

  • Inconsistency in the data display

  • Instance data being overwritten by another instance

  • Locking conflicts

There is an implementation example in the CL_SWF_FORMABSENC demo class. 

17.              BI_PERSISTENT~LPOR Method:

The BI_PERSISTENT~LPOR method is the counterpart to the BI_PERSISTENT~FIND_BY_LPOR method. It provides the persistent display for an existing instance of an ABAP object. 

Features: 

The method returns the persistent display of an object reference as a SIBFLPOR type structure as described earlier. 

There is a close relationship between the BI_PERSISTENT~FIND_BY_LPOR method and the BI_PERSISTENT~LPOR method. If we call the BI_PERSISTENT~FIND_BY_LPOR method first and then the BI_PERSISTENT~LPOR method, the BI_PERSISTENT~LPOR method must return the same value as was previously used to call the BI_PERSISTENT~FIND_BY_LPOR method. 

There are also several ways of implementing this method in this case. There is an implementation example in the CL_SWF_FORMABSENC demo class.

18.              BI_PERSISTENT~REFRESH Method:

SAP WebFlow Engine calls the BI_PERSISTENT~REFRESH method when the system has to ensure that all values of an object are valid or that they agree exactly with the persistent display of the object. 

Features: 

The method implementation depends on the internal organization of the class. We can check the object instance data in the database, if necessary.

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.

To Continue....Click here 

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