Show TOC

Workflow User ExitsLocate this document in the navigation structure

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

There are 3 possible entry points:

  • At the moment of reading the item.

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

  • When a notification is sent to the approver after any change in the item

This section describes the procedure for using these user exits.

Entering Code after the Item has been Read

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 is displayed.

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

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

    • To make the new functionality applicable when notifications are sent to the approver after any change in the item (Push BAdI): /IWWRK/ES_WF_ITEM_SEL_OB

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

    • To make the new functionality applicable when an item is opened for reading (Read BAdI): /IWWRK/ES_WF_CUST_EXT_IB

  4. Choose Create Impl. The Create Enhancement Implementation page is displayed.

  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 is displayed.

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

  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 is displayed.

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

  14. Double-click Filter Val.

  15. Choose Create Combination. The Choose Filter page is displayed.

  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.

    Note

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

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

  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 is displayed.

  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 Cancel Update flag parameter which, if switched on, causes the update to be canceled (the decision is not applied).

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

    • For the Push BAdI: This BAdI gives you the option to enter any desired text. Parameters:

      • Workitem ID - cannot be changed

      • Table structure that contains: text and Language

        The table can be edited and the data in the table is sent to the client. (not mandatory).

  26. Choose Save and then Activate. The Inactive Objects page is displayed.

  27. Select all objects and click 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.

For the Push BAdI, when the workflow notifications are sent to the SAP Gateway system, the added functionality should be apparent.