cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding Table - Web Dynpro ABAP

Former Member
0 Kudos

Hi,

Is there a way to hide a whole table if it is empty?

Which method or path should I use in order to hide the table?

Thanks,

Erick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You could bind the "visible" property to a calculated context attribute that returns Visibility.NONE, if the data source node size equals 0.

Armin

Former Member
0 Kudos

Hi Armin,

Can you detail a bit more those steps. Which methods should I use?

Thanks,

Erick

srinivasa_raghavachar
Participant
0 Kudos

Hi Erick,

You do not use any method and but bind the property 'visible' of table to a context attribute.

Here are the detailed steps:

1) Goto the layout of your view.

2) Double click on table element.

3) On the RHS, you see many properties, goto property Visible and bind it to a context attribute. The purpose of this context attribute is to control visibility and hence you would have to add this to your context.

4) Set the value of this context attribute to Visible or not depending on the data. Check table documentation for more details.

Regards,

Srini.

Former Member
0 Kudos

In the NWDS you would do this as follows (I suppose in the ABAP IDE it's similar):

Add a new context attribute "TableVisibility" to the view controller context, choose type = "com.sap.ide.webdynpro.uielementdefinitions.Visibility", calculated=true, readOnly=true.

Select the table in the view designer and bind property "visible" to attribute "TableVisibility".

For the calculated attribute, a get-method is generated. In the implementation of this get-method, return WDVisibility.NONE if the table data source node is empty, WDVisibility.VISIBLE else.

Armin

Former Member
0 Kudos

Hi,

Great help, but I found the type WDUI_VISIBILITY to set as the context's type and it is NUMC(2) where I could not set the attribute 'visible' to it.

Thanks

Erick

Former Member
0 Kudos

Hi,

Thank you vary much for the help.

You guided me to this solution:

  • set single attribute

elem_context->set_attribute(

EXPORTING

name = `VISIBILITY`

value = CL_WD_TABLE=>E_VISIBLE-VISIBLE ).

Erick

thomas_szcs
Active Contributor
0 Kudos

Hi Erick,

WDA also offers the possibility to bind visible to a boolean attribute. Please use type WDY_BOOLEAN within the context as usual. This will allow you to avoid using the numc2 type.

Best regards,

Thomas

Answers (0)