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):
USMD_SEARCH(From MDG 7.0):
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
- 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_visible–none(01)
- cl_wd_uielement=>e_visible-visible(02)
Example implementation:
With this implementation , tool bar button Mass change would be hidden
USMD_ENTITY_SEARCH
USMD_SEARCH
2. Adding new tool bar buttons:
New tool bar buttons could be added by manipulating parameter ET_ADDITIONAL_EVENT of method INITIALIZE.
Handling of the event triggered by this button could be done in method PROCESS_EVENT
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?
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
Is it possible to show the config done on the call of UI on Process Events?