Dynpro – How to disable functions instead of hiding them in a screen

SAPIf you need to manipulate with a screen dynamically, sometimes you need to enable/disable some functions/buttons in the toolbar. Standard exclusion of function when setting PF-STATUS will by default hide the excluded functions. But what if you want to display them, but just in disabled state ?

In the following picture you can see the screen without any function deactivated

All functions

Here’s the sample code of a screen PBO module where we exclude some functions

MODULE pbo OUTPUT.
  DATA:
    lt_ucomm TYPE TABLE OF sy-ucomm.

  FIELD-SYMBOLS:
    <fs_ucomm> TYPE sy-ucomm.

  CLEAR lt_ucomm[].

  APPEND INITIAL LINE TO lt_ucomm ASSIGNING <fs_ucomm>.
  <fs_ucomm> = 'REFRESH'.

  SET PF-STATUS 'MY_PF_STATUS' EXCLUDING lt_ucomm.

* ... futher code  
ENDMODULE.

The output of screen will now be following:

Function excluded

If you prefer the excluded functions to be just disabled but visible, you have to modify the PF-STATUS Application toolbar attributes:

Attributes of Application toolbar

and select “Display all” option.

"Display all" attribute

Now the screen output will look like this

Function disabled

Leave a Reply