Show TOC

Workflow User ExitsLocate this document in the navigation structure

User exits are the options given to the Workflow user to add custom code into the standard Workflow code.

There are three possible entry points:

  • When querying inbox or outbox items – changing the task subject.

  • At the moment of reading a specific item – changing the task subject and description and adding extensible elements.

  • Before an action has been taken on a 'User Decision' item (a decision has been taken by the approver).

This section describes the procedure for using these user exits.

Implementing Your Own Code

It is possible to extend the work item data. For this you must create a BAdI that enables new functionality at the chosen entry point.

To create a new BAdI:

  1. In the SAP system you are using, open transaction SE19. The BAdI builder initial screen for Implementations page displays.

  2. In the Create implementation area, select the New BAdI radio button.

  3. In the Enhancement Spot field, enter the following:

    • To change the task subject on inbox and outbox queries and when reading specific items (Modify Items BAdI): /IWWRK/ES_WF_MODIFY_ITEMS_IB

    • To add extensible elements and change of task subject and description when reading a specific item (Read BAdI): /IWWRK/ES_WF_CUST_EXT_IB.

    • To make new functionality applicable before a decision has been applied on a 'User Decision' item (Before Update BAdI):/IWWRK/ES_WF_WI_BEFORE_UPD_IB

  4. Choose Create Impl. The Create Enhancement Implementation page displays.

  5. In the Enhancement Implementation field, enter the name of the new BAdI that will contain the code to be added.

  6. In the Short Text field, add a short explanation of the BAdI’s function.

  7. Choose the checkmark. The Create Object Directory Entry page displays.

  8. Save the BAdI in the package supplied to you by an administrator. The Enhancement Implementation: Create BADI Impl. page displays.

  9. In the BAdI Implementation column, enter a name for the BAdI implementation, for example, BADI_IMPLEMENTATION.

  10. In the Implementation Class column, enter a name for the BAdI implementation class, for example, ZBADI_IMPL_CLASS.

  11. In the BAdI Definition column, open the drop-down list and select the BAdI definition name (there is only one definition name in Workflow for SAP Gateway).

  12. Choose the checkmark. The Enhancement Implementation Display page displays.

  13. Under BAdI implementations, expand the BAdI you have just created.

    Note

    Steps 14-20 are not relevant for the Modify Items BAdI. This BAdI does not have filter values and therefore cannot have more than one active implementation.

    If no filter values are entered, your code is applied to ALL workflows!

  14. Double-click Filter Val.

  15. Choose Create Combination. The Choose Filter page displays.

  16. Select the WORKFLOW_ID and STEP_ID rows and choose the checkmark.

  17. In the Filter Values section, double-click the question marks in the first row of the Value 1 column. The Change Filter Value is displayed.

  18. In the Value 1 field, enter the step ID.

  19. In the Comparator 1 drop-down list, select the equals sign (=).

  20. Choose the checkmark.

  21. In the Filter Values section, double-click the question marks in the second row of the Value 1 column. The Change Filter Value is displayed.

  22. In the Value 1 field, enter the Workflow ID.

  23. In the Comparator 1 drop-down list, select the equals sign (=).

  24. Choose the checkmark.

  25. In the Enhancement Implementation: Change page, double-click the implementing class node in the BAdI implementations section.

  26. Double-click the relevant method displayed. You are asked if you want to create the new implementation class.

  27. Choose Yes. You are asked if you want to save the new enhancement implementation.

  28. Choose Yes. The ABAP editor displays.

  29. Add your desired code in the ABAP editor.

    Note
    • For the Modify Items BAdI: The import parameter is a table of inbox or outbox items. The output parameters are the modified items (with the task subject only) and a return message table. If the return message table contains error messages, an exception is raised to the SAP Gateway system.

    • For the Before Update BAdI: The import parameters are the workflow item details, the workflow item's container elements, and the workflow item's extensible elements (XPROPs). The method returns a message table. If the return message table contains error messages, an exception is raised to the SAP Gateway system.

      The change parameters are:

      • Table of {Key, Value} pairs that are added to the Extensible Elements collection.

      • Task subject text.

      • Task description.

    • For the Read BAdI: The import parameters are the Workflow item details. The output parameters are:

      • Table of {Key, Value} pairs that are added to the Extensible Elements collection.

      • Task subject text.

      • Task description.

  30. Choose Save and then Activate. The Inactive Objects page displays.

  31. Select all the objects and choose the checkmark.

Recommendation
  • Send a Workflow Item request from the same Workflow ID number you used in the BAdI.

For the Modify Items BAdI, when the approvers view their inbox or outbox items, or a specific inbox or outbox item, the added functionality should be apparent.

For the Read BAdI, when the approver opens the Workflow request, the added functionality should be apparent.

For the Before Update BAdI, when the approver makes a decision, the added functionality should be apparent.