You are on page 1of 1

Dynamcally hiding an assignment block

The UI config utility allows us to assign assignment blocks to a overview page depending on the user role, object type, component usage
name etc., But, there may be cases where we would like to hide the assignment blocks based on some validations during run time. This wiki
will show you how to do it.
Step 1 - Identify the name of the assignment block
Go to the run time repository of the component. Note down the component usage name. Note down the interface view name. Now, the
name of the assignment block page will be
'component_usage_name'.'interface_view_name'. (concatenate both separated by '.' )
Step 2 - Overview page coding
Detaching Views
In the overview page controller, redefine the method 'DETACH_STATIC_OVW_VIEWS'. This method will be called during each page
refresh and will return views to be removed from the overview page.

DATA: ls_viewid TYPE bsp_dlc_ovw_stat_view_attach.


CONSTANTS: c_view_id TYPE string VALUE 'CUBTOrgSet.BTORGSET/OrgSet'.
*do validations
*if validation fails
ls_viewid-viewid = c_view_id.
APPEND ls_viewid TO rt_viewid.
*endif
Reattaching Views
In the same overview page controller, redefine the method 'REATTACH_STATIC_OVW_VIEWS'.
*basically the same code as in detach views. The return table carries the views to be reattached
*Make sure that the views are not attached already

DATA: ls_viewid TYPE bsp_dlc_ovw_stat_view_attach.


CONSTANTS: c_view_id TYPE string VALUE 'CUBTOrgSet.BTORGSET/OrgSet'. *if validation ok
READ TABLE view_area WITH KEY appl_viewname = c_view_id
type
= space
traymode
= abap_undefined
transporting no fields.
if sy-subrc = 0.
ls_viewid-viewid = c_view_id.
APPEND ls_viewid TO rt_return.
endif.

You might also like