Show TOC

Creating a New User Exit (BAdI)Locate this document in the navigation structure

To implement your own code, create a new user exit, known as a Business Add-In (BAdI), that enables a new functionality at the chosen entry point.

To create a new BAdI, proceed as follows:

  1. In your SAP system, start transaction SE19. The BAdI Builder: Initial Screen for Implementations screen is displayed.

  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 title for all items when executing a query operation on the Task Collection (Query BAdI), enter /IWPGW/ES_TGW_TASK_QUERY.

    • To change the task title or task description for a specific item when executing a Read operation on the Task Collection or Task Description Collection (Read BAdI), enter /IWPGW/ES_TGW_TASK_DATA.

    • To change the user details that are returned by the service, enter /IWPGW/ES_TGW_USER_DETAIL.

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

  5. In the Enhanced Implementation field, enter the name of the new BAdI that will contain the code you want to add.

  6. In the Short Text field, add a short description of the BAdI's function.

  7. Press the checkmark. The Create Object Directory Entry screen is displayed.

  8. Save the BAdI in the appropriate package. The Enhancement Implementation: Create BAdI Impl. screen 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, select the BAdI definition name from the dropdown list (for SAP Gateway there is only one definition name in Workflow.

  12. Press the checkmark. The Enhancement Implementation Display screen is displayed.

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

  16. Select the PROVIDER_ID and the TASK_DEF_ID rows and press the checkmark.

    Note

    The filter name TASK_DEF_ID does not exist for the BAdI /IWPGW/BADI_TGW_TASK_QUERY or /IWPGW/ES_TGW/USER_DETAIL.

  17. In the Filter Values section, replace the question marks in the Value 1 column with the task provider ID and the task definition ID.

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

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

  20. Press the checkmark.

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

  22. Double-click the relevant method.

  23. Press the checkmark. The ABAP Editor is displayed.

  24. When prompted, choose Yes.

  25. Add your additional code.

    Note
    • For the Query BAdI: The import parameters are the task provider ID and the table containing all task header details. The output parameter is a table containing the task IDs and the corresponding task IDs after modification.

    • For the Read BAdI: The import parameters are the task provider's ID and the task header details.

      • In the MODIFY_TASK_TITLE method, the output (Changing) parameter is the task title after modification.

      • In the MODIFY_TASK_DESCRIPTION method, the output (Changing) parameter is the task description after modification.

    • For the User Info BAdI: There are two methods in the BAdI interface, one for retrieving textual user details and the other for retrieving the user's image. Both of these methods receive an instance ID, navigation path, URL parameters, and a referent to the current provider façade implementation. The output parameter for the first method is the user details structure and for the second method, a media resource structure. The BAdI finds the user based on the import parameters and retrieves the user's details and image as applicable.

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

  27. Select all objects and press the checkmark.