Skip to Content
Author's profile photo Raghuram Reddy Devagiri

How to control toolbar buttons in Entity search for MDG custom objects

This document explains how to control tool bar buttons for e.g. Hiding/Adding buttons in Entity search applications provided for custom objects by SAP by using BADI USMD_SEARCH.

For custom objects or custom data models , SAP has provided following search applications.

USMD_ENTITY_SEARCH(Till MDG 6.1):


10-17-2014 10-19-43 PM.jpg

  USMD_SEARCH(From MDG 7.0):


USMD_SEARCH.jpg

The above mentioned applications could be generically used for searching the data of all the entities defined in a custom data model.

In both the applications , certain tool bar buttons are pre delivered by SAP.

Sometimes it might be necessary to hide some of the buttons for e.g. Mass Change for all or certain entities of a data model . It might also be needed to add some additional tool bar buttons.

This could be achieved by creating implementation of BADI  USMD_SEARCH and by implementing necessary coding in the method Initialize and Process_Event of the implementing class.

First step is to create an implementation of BADI USMD_SEARCH. The custom data model should be set as a filter criteria

/wp-content/uploads/2014/10/filte_566230.jpg

  1. Hiding standard tool bar buttons:

       Hiding tool bar buttons could be achieved manipulating exporting parameter ET_STANDARD_EVENT of method INITIALIZE.

       The tool bar button to be hidden should be passed to field EVENT_ID.  For USMD_ENTITY_SEARCH and USMD_SEARCH , event ids are different.

      Following are the list of standard event ids available for USMD_ENTITY_SEARCH.

    • ALV_FCT_CREATE(Create Button)
    • ALV_FCT_CHANGE(Change Button)
    • ALV_FCT_COPY(Copy Button)
    • ALV_FCT_MASSCHANGE(Mass Change Button)
    • ALV_FCT_CNGDOCS(Change Documents Button)
    • ALV_FCT_WHEREUSED(Where Used Button)

      Following are the list of standard event ids available for USMD_SEARCH

    • NEW(Create Button)
    • COPY(Copy Button)
    • MASS_CHANGE(Mass Change Button)
    • MULTI(Multi-Processing button)
    • CHANGE_DOCS( Change Documents button)
    • REPL_STATUS ( Replication Status button)
    • REPLICATE( Replicate button)

    Visibility could be controlled by passing the following values to field VISIBILITY

    • cl_wd_uielement=>e_visiblenone(01)
    • cl_wd_uielement=>e_visible-visible(02)


    Example implementation:

/wp-content/uploads/2014/10/example_impl_566243.jpg

      With this implementation , tool bar button Mass change would be hidden

      USMD_ENTITY_SEARCH

   

    /wp-content/uploads/2014/10/hidden_old_566253.jpg

        USMD_SEARCH

  

     /wp-content/uploads/2014/10/hidden_new_566254.jpg


    2.  Adding new  tool bar buttons:

   

        New tool bar buttons could be added by manipulating parameter ET_ADDITIONAL_EVENT of method INITIALIZE.

        /wp-content/uploads/2014/10/new_add_566258.jpg

          /wp-content/uploads/2014/10/get_d_566261.jpg

           Handling of the event triggered by this button could be done in method PROCESS_EVENT

            /wp-content/uploads/2014/10/process_566264.jpg

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Benjamin Allsopp
      Benjamin Allsopp

      Process entities for ALV_FCT_CHANGE(Change Button) doesn't seem to call every time. Sometimes works fine but the next moment the error -Your user master record does not contain a valid UI configuration - is displayed instead.


      I can't work out why different behaviour from moment to moment. Any ideas?


      Also when I add a button - it runs the code but can't find a webpage - any reason why?

      Author's profile photo Raghuram Reddy Devagiri
      Raghuram Reddy Devagiri
      Blog Post Author

      Hi Benjamin,

      Regarding the first error , I believe it could be resolved by assigning a configuration to the user in the role

      Could you provide some more details about the second issue?

      Regards,

      Raghu

      Author's profile photo Morris Castillo
      Morris Castillo

      Is it possible to show the config done on the call of UI on Process Events?