cancel
Showing results for 
Search instead for 
Did you mean: 

Hide Selection Menù in ABAP CL_WD_TABLE (not ALV)

matteo_montalto
Contributor
0 Kudos

Hi gurus,

I'm dealing with a Table (CL_WD_TABLE) which has "auto" as selectionMode and allow, at runtime, multiple selection.

Therefore, in the upper left corner of the table there's a standard selection switch, that allows these two actions:

- select all;

- deselect all.

My aim is to hide such a Selection Menù, as we have to forbid such operations on the table (only manual selection, even multiple, should be performed).

Tried to find a way to suppress that menù but found nothing; also, I tried to intercept the actions performed by the two possibility (select/deselect all) but again, no luck.

Is ther any (easy) way to hide that button or alternatively, create a pre/post exit on the methods triggered by these two events?


As usual, thanks again.

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Matteo,

According to the documentation, the select-all/deselect-all menu options come automatically when the table allows multiple selections...

If multiple selections can be made in the Table, that is, if selectionMode = multi or multiNoLead, or if selectionMode = auto and dataSource has selection cardinality 0..n or 1..n, the user can select or deselect rows using the menu.

I do see a method in CL_WD_TABLE that I would expect to disable this menu, but it doesn't appear to be supported yet. The below code doesn't have any effect.


   DATA lo_sel_menu_cfg TYPE REF TO cl_wd_table_sel_menu_cfg.
   DATA lo_view                  TYPE REF TO if_wd_view.
   DATA lo_table                 TYPE REF TO cl_wd_table.



* Create a Table Selection Menu Configuration object with mass selection disabled

   lo_sel_menu_cfg = cl_wd_table_sel_menu_cfg=>new_table_sel_menu_cfg(
       mass_selection_options = abap_false
   ).

* Set the disabled
Table Selection Menu Configuration object in the Table UI element
   lo_view ?= wd_this->wd_get_api( ).
   lo_table ?= lo_view->get_element( 'TABLE' ).
   lo_table->set_sel_menu_cfg( lo_sel_menu_cfg ).

An alternative for your requirement could be to get rid of the selection column with selectionColumnDesign=None and instead provide the user with a column of checkboxes which they can individually check or uncheck.


Cheers,

Amy

matteo_montalto
Contributor
0 Kudos

Thanks Amy,

I tried too, also binding the mass_selection_options property to a WDY_BOOLEAN value in the context and passing the (optional) view reference. It didn't work.

Is there any way to understand why this method isn't supported yet? We're working on the latest SRM version, I suppose there should be a document which states what's properly working e what is actually "experimental".

amy_king
Active Contributor
0 Kudos

Hi Matteo,

I looked around the web for class documentation for CL_WD_TABLE but couldn't find any. I was hoping to learn whether SAP claims the method is supported or not for [your-version-here]. Maybe you can find it or maybe your company loads SAP's documentation for objects-- mine doesn't so I get a "not available" message when I click on...

Maybe you can open a message with SAP asking why the method doesn't seem to have any effect-- they may come back saying it's not yet (or no longer) supported, but at least you'll have an answer.

Cheers,

Amy

Answers (0)