Show TOC

Function documentationTab Page Programming Exits Locate this document in the navigation structure

 

You can enter programming exits on this tab page. A programming exit is an ABAP class that the system executes at a specific time during the processing of a workflow. Programming exits enable you to implement your own enhancements and adaptations.

Caution Caution

ABAP classes that you use as programming exits must not use the following elements:

  • COMMIT WORK

  • ROLLBACK WORK

  • Calling the function module DB_COMMIT

  • Any type of RFC calls

  • Change a system element in the container

For performance reasons, SAP recommends that you only execute database selections that are entirely necessary.

End of the caution.

Features

ABAP classes that you specify here as programming exits must implement the interface IF_SWF_IFS_WORKITEM_EXIT. The system executes the classes in the specified order.

The method EVENT_RAISED is executed from every ABAP class as soon as the relevant work item performs a status change defined in the interface.

Container Access

To work with the container in an ABAP class, you have to include the include files <CNTN02> and <CNTN03>.

Exception Handling

Dealing with Exceptions For ABAP classes that implement the interface IF_SWF_IFS_WORKITEM_EXIT, in the method EVENT_RAISED you can raise an exception of the class CX_SWF_IFS_WORKITEM_EXIT_ERROR.

If an exception is raised, the relevant work item and workflow are given the status Error. Once you have corrected the error, you must trigger the continued processing of the workflow in transaction SWPR. Dialog work items are given the status Ready and are executed again.

You can define a T100 message for the exception (transaction SE91). If the exception occurs, the system writes the message to the workflow log.

The following table contains details about how to deal with exceptions depending on when exactly they occur:

When Exception is Raised

How Error is Handled

When creating a workflow (BEF_CREATE and CREATED)

The workflow is not created.

A workflow started manually by the user reports the error to the user.

In workflows that are started by a start event, the error is visible in the event log.

When a workflow is being executed

The current work item and the workflow are given the status Error. If the current work item is not available in the database, the workflow log records the error for the preceding step.

When a work item is being processed (for example, forwarded, accepted, retained, set to completed, or undergoing a status change)

The changes are reset and the relevant function module returns an error.

When the status is being changed to Error or Completed.

The workflow log records the exception; otherwise it is ignored.

Therefore, do not raise exceptions for the event STATE_CHG in programming exits. However, the programming exit can write an entry to the workflow log when you use the work item context.

Example

The class CL_SWH_WORKITEM_EXIT is an example of an ABAP class that supports the interface IF_SWF_IFS_WORKITEM_EXIT.

A process info system is created for the SAP workflow Process notification of absence (AF_APPROVE, WS30000015) using the programmer exit. In addition, the workflow property sap.bc.bmt.wfm.process.status is evaluated in the programmer exit.

To call the process info system, choose   Tools   Business Workflow   Development   Demo   Work Item Exits   Process Info System  .