Show TOC

Workflow User ExitsLocate this document in the navigation structure

User exits are the options given to the SAP Gateway consumer to add custom code into the standard Workflow code.

There are three possible entry points:

  • When changing the work item description.

  • When adding extensible elements.

  • When executing a 'User Decision' action (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 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

    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 the STEP_ID rows and choose the checkmark.

  17. In the Filter Values section, replace the question marks in the Value 1 column with the Workflow ID and the Step ID numbers, each in its relevant row.

  18. For each row, choose the question marks in the Comparator field. The Display Filter Value page displays.

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

  20. Choose the checkmark.

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

  22. Double-click the relevant method displayed.

  23. Choose the checkmark. The ABAP editor displays.

  24. When prompted, choose Yes.

  25. Add your desired code in the ABAP editor.

    Note
    • 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. In case the return message table contains error messages, an exception is raised to the SAP Gateway system.

      • 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.

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

  27. Select all objects and choose the checkmark.

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

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.