Skip to Content
Author's profile photo Former Member

Detail popup using cl_salv_table by default don’t display blank fields. SOLUTION

Dear all,

below is description how to enhance standard classes to get Detail popup displaying the blank fields.

Class CL_SALV_CONTROLLER_METADATA

——————————————————————–

Method COMPLETE_METADATA_SLIS_TO_LVC() – Post-Exit

    if r_display_settings is bound.
      s_layout
detailinit = r_display_settings->get_detail_initial( ).
   
endif
.

Endmethod.

Method GET_SLIS_LAYOUT – Post-Exit.

  if r_display_settings is bound.
    s_layout
detail_initial_lines = r_display_settings->get_detail_initial( ).
  endif
.

Endmethod.

Method GET_LVC_LAYOUT – Post-Exit.

    if r_display_settings is bound.
      s_layout
detailinit = r_display_settings->get_detail_initial( ).
   
endif
.

Endmethod.

Class CL_SALV_DISPLAY_SETTINGS

——————————————————————–

Description: Create new enhancement and create below attribute with GET and SET methods.

Instance Private: DETAIL_INITIAL type LVC_DETINI default FALSE

Public Methods:

Method GET_DETAIL_INITIAL.

  result = detail_initial.

Endmethod.

Method SET_DETAIL_INITIAL.

  if detail_initial ne i_value.

    detail_initial = i_value.

if r_controller is bound.
  r_controller
->set_changed(
  name       
= name
  ref          = me
  flavour     
= if_salv_c_changelist_flavour=>setter
  refresh_mode
= if_salv_c_refresh=>soft
  method      = ‘SET_DETAIL_INITIAL’ ).
endif.
endif.

Endmethod.

Usage:

data: mo_salv_table    type ref to cl_salv_table.

data: mt_result        type tt_result.

    call method cl_salv_table=>factory
      exporting
        list_display
= abap_false
      importing
        r_salv_table
= mo_salv_table
      changing
        t_table     
= mt_result.

    lr_display_settings = mo_salv_table->get_display_settings( ).
    lr_display_settings
->set_list_header( l_title ).
    lr_display_settings
->set_detail_initial( abap_true ).  “ Enhanced method
    mo_salv_table
->display
( ).

Then after press of Detail icon (the first icon in below image) on ALV report, you will also see empty fields in the Detail popup.

ALV Toolbar - Detail button functionality.jpg

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hello Petr,

      Can you please attach screenshots of how the UI looks before & after your enhancement?

      BR,

      Suhas    

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Suhas, I have attached the image. After pressing the Detail button in toolbar you will see the blank fields. E.g. Pallets(estimate) = 0. Br. Petr