Skip to Content

Full screen CL_SALV_TABLE – Excluding PF-Status functions (a solution)

I’m sure we all know by now that CL_SALV_TABLE is an excellent class for quickly presenting tabular data to the user.  However, it’s not without its limitations and annoyances (as I’m sure you all know by now as well).

One of the (admittedly minor) things that irritates me about working with CL_SALV_TABLE is the inability to exclude GUI functions when using the full screen variant of the ALV.  This has finally prompted me to do something about it!

So, the way we normally set a custom PF-Status when using the full-screen variant of the ALV is to use the SET_SCREEN_STATUS method of CL_SALV_TABLE.

Easy enough…

o_salv_table->set_screen_status( report = 'ZMYREPORT'
                                 pfstatus = 'CUSTOM_FULLSCREEN' ).

However, this method provides no way of specifying functions to exclude should we need to.

For those who may have tried, using CL_SALV_TABLE->GET_FUNCTIONS and attempting to use ENABLE_FUNCTION to disable functions is fruitless and ultimately ends in a short-dump telling you this action isn’t supported for full-screen SALV variants.

Wouldn’t it be nice if we could just write something like:

o_salv_table->set_screen_status( report = 'ZMYREPORT'
                                 pfstatus = 'CUSTOM_FULLSCREEN'
                                 excluding = gt_extab ).

Well, with a couple of implicit enhancements (3 to be precise) you now can!

Enhancement 1

In class CL_SALV_MODEL_BASE display the “Attributes” tab and click on the “Enhance” icon.  Create an Enhancement Implementation and corresponding Composite Enhancement Implementation.  e.g.

Create a new attribute called something like “I_FULLSCREEN_EXCLUDE_PF” (I’m sure you’ll think of something better) with a type of KKBLO_T_EXTAB.  This attribute should be an Instance Attribute and have Public scope/visibility.

Within the same class (CL_SALV_MODEL_BASE) select the Methods tab and view the parameters for method SET_SCREEN_STATUS.

Add a new importing parameter called “Excluding” also with a type of KKBLO_T_EXTAB.

Save and activate the enhancement.

Enhancement 2

Within the same class (CL_SALV_MODEL_BASE), view the source code for the aforementioned method SET_SCREEN_STATUS.  Click on the “Enhance” icon again and use the menu option to Show Implicit Enhancement Options.  Scroll to the bottom of the method code and create a new Code enhancement at the bottom, right before the “ENDMETHOD” statement.  Make sure it’s a component of the Composite Enhancement Implementation that you created in the first step.

Use the following code in this enhancement:

if excluding is supplied.
  me->i_fullscreen_exclude_pf[] = excluding[].

Save and activate the enhancement.

Enhancement 3

The final enhancement takes place in class CL_SALV_FULLSCREEN_ADAPTER, so this new functionality will only take effect for the full-screen variant of CL_SALV_TABLE.

View the code for method IF_SALV_STATUS_ADAPTER~BUILD_UIFUNCTION and you will see it does some stuff with a T_EXTAB internal table.  This is the table we need to modify if any exclusions have been passed to SET_SCREEN_STATUS.

So, as in the previous step, we need to create another Implicit Enhancement at the end of the method code, again making sure it’s part of the same Composite Enhancement Implementation.

Then copy the following code into the enhancement:

if lr_model is bound and lr_model->i_fullscreen_exclude_pf[] is not initial.
  append lines of lr_model->i_fullscreen_exclude_pf to t_extab.

Save and activate the enhancement and we’re done!  Enjoy!

Let me know what you think and if you can think of any improvements.  Admittedly, the additional attribute on CL_SALV_MODEL_BASE feels a bit hacky.

You must be Logged on to comment or reply to a post.
    • Hi Shai,

      I did try this, but unfortunately like ENABLE_FUNCTION it does not work for full-screen SALV variants.  This is due to this branch within the method…

        if lr_controller->r_model->get_display_object( )
                                eq if_salv_c_table_objects=>grid.
          value = remove_item( name ).
          l_name = name.
          message w027(salv_exception)
            with 'CL_SALV_FUNCTIONS' 'REMOVE_FUNCTION' 'Function: ' l_name
            into l_msgtext.                                       "#EC NOTEXT
          ls_message-msgid = sy-msgid.
          ls_message-msgno = sy-msgno.
          raise exception type cx_salv_wrong_call
              textid   = ls_message
              object   = 'Function'
              key      = l_name
              class    = 'CL_SALV_FUNCTIONS'                      "#EC NOTEXT
              method   = 'REMOVE_FUNCTION'.                       "#EC NOTEXT

      Kind regards,


      • You’re right.
        In case of fullscreen, you should use method SET_FUNCTION.

        I do agree that all these combinations (for grid/fullscreen mode) are quite confusing.
        You may check demo program SALV_TEST_FUNCTIONS as reference.

    • Thanks for the info Jelena.  You know, I could have sworn I tried this (maybe it was SET_ENABLE I tried instead??)… just tried it again and yes, that does appear to work!  Oh well, I do like the convenience of the extended SET_SCREEN_STATUS method.  🙂