cancel
Showing results for 
Search instead for 
Did you mean: 

UI table - "Select All" / "Delete Selection"

Former Member
0 Kudos

Hi experts,

I have UI Table and a button in my WDA.

I need to enable a button if "Select All" was clicked and disable a button if "Delete Selection" was clicked.

How could I recognize what was clicked ?

Thank you,

Tatyana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

PG,

I am using Table selection menu of UI Table.

It is in the 1st column of the table. When you click the 1st column header - then there is a choice of "Select All" and "Delete selection".

I need to build a logic depending on what was clicked.

If "Delete selection" was clicked - then I want to disable my button "Fil out PDf form".

Thank you,

Tatyana

Former Member
0 Kudos

Hi tatyana,

this solution solve your problem.

whenever you click select all or deselect all from table menu, it execute ONSELECT event,

u create one node with attribute type wdui_visibility default value 1 and bind it with your button visibility property. now in on select event , read the node that you have bind to table, and check the context element is initial or not,

for select all option it is not initial and for deselect all it is initial. just chekc the coding in ONSELECT event of table.

DATA LO_ND_NODE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_NODE TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_NODE TYPE WD_THIS->ELEMENT_NODE.

DATA LV_READ LIKE LS_NODE-READ.

  • navigate from <CONTEXT> to <NODE> via lead selection

LO_ND_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_NODE ).

  • get element via lead selection

LO_EL_NODE = LO_ND_NODE->GET_ELEMENT( ).

  • get single attribute

DATA LO_ND_TABLE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_TABLE TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_TABLE TYPE WD_THIS->ELEMENT_TABLE.

  • navigate from <CONTEXT> to <TABLE> via lead selection

LO_ND_TABLE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_TABLE ).

  • @TODO handle not set lead selection

IF LO_ND_TABLE IS INITIAL.

ENDIF.

  • get element via lead selection

LO_EL_TABLE = LO_ND_TABLE->GET_ELEMENT( ).

  • @TODO handle not set lead selection

IF LO_EL_TABLE IS INITIAL.

LO_EL_NODE->SET_ATTRIBUTE(

EXPORTING

NAME = `READ`

VALUE = '01' ).

ELSE.

LO_EL_NODE->SET_ATTRIBUTE(

EXPORTING

NAME = `READ`

VALUE = '02' ).

LO_EL_TABLE->GET_STATIC_ATTRIBUTES(

IMPORTING

STATIC_ATTRIBUTES = LS_TABLE ).

ENDIF.

Yogesh N

Answers (4)

Answers (4)

Former Member
0 Kudos

Yogesh,

Thank you very much.

Points are awarded.

Tatyana

Former Member
0 Kudos

Regards,

Yogesh N

Former Member
0 Kudos

Hi Tatyana,

Can u tell that how u r implementing Select All and Delete Selection funtionality with your table ui .

If i consider that u have implemented this by using two buttons and u want to control the visibility of third button then u just need to create a attribute with type wdy_boolean and bind this attribute with enable property of your button which you want to control,.(make the value of this attribute abap_true or abap_false depending on ur requirement)

I think this is the easiest solution if u r implementing by this way.

Or if u r using some other method then please explainn it.

regards

PG

Former Member
0 Kudos

Hi Tat,

I would expand on Zhao's suggestion.

In the context, create a node with an element of type WDUI_VISIBILITY.

Bind the Visible property of the button to this element in the layout.

Now check for the table you populate using Zhao's method.

If the internal table is not initial, then using SET_ATTRIBUTE, give value of the Visible attribute as '02'.

former_member131774
Contributor
0 Kudos

Using IF_WD_CONTEXT_NODE->GET_SELECTED_ELEMENTS will get all selected lines

And then you can use this to do the select/deselect logic.