cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro - not displaying when table is empty

Former Member
0 Kudos

hi

i am creating a webdynpro which contains a table - i did it in the component controller

i want this table to be displayed only if its not initial

is it possible ?

thanks

Ami

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can create a context attribute (type com.sap.tc.webdynpro.progmodel.api.WDVisibility) and bind it to the "visible" property of the table. Then you just have to set this variable to WDVisibility.NONE if the table is empty.

EDIT : sorry, didn't realize you use WD ABAP. Here's a tutorial for WD ABAP : http://wiki.sdn.sap.com/wiki/display/WDABAP/SimpleapplicationtochangepropertiesofUIElementsduringruntimeinWebDynpro+ABAP

Regards,

Pierre

Edited by: Pierre DOMINIQUE on Jul 21, 2009 3:00 PM

Answers (3)

Answers (3)

raja_narayanan2
Active Participant
0 Kudos

Hi..

Follow this step to display the table only if it has values....

1) You will have table context which will be binded to your table.. get the table vaules using....

  • get all declared attributes

lo_nd_table->get_static_attributes_table(

IMPORTING

table = lt_nd_table ).

2) Now create a attribute called table_visible and type is WDUI_VISIBILITY.

Bind that attribute with the table visible property.

Now check the condition.

if lt_nd_table is inital.

lo_el_nd_table-table_visible = if_wdl_core=>visibility_none.

else.

lo_el_nd_table-table_visible = if_wdl_core=>visibility_visible.

  • Bind the Table Values

lo_nd_table->bind_table( lt_nd_table ).

endif.

Hope this will help you.

Regards

Raja

Former Member
0 Kudos

Hi,

Under Context,create attribute VISIBILE of type wdui_visibility.

Bind the context attribute to the table visible property.

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

lo_nd_nd_nodename = wd_context->get_child_node( name =

wd_this->wdctx_nd_nodename ).

  • get element via lead selection

lo_el_nd_nodename = lo_nd_nd_nodename->get_element( ).

  • get all declared attributes

lo_nd_nd_nodename->get_static_attributes_table(

IMPORTING

table = lt_nd_nodename ).

Now set the visibility as

if lt_nd_nodename is not initial.

  • set single attribute

lo_el_nd_<visibilitynode>->set_attribute(

EXPORTING

name = `VISIBLE`

value = '02' ). "visible

else.

  • set single attribute

lo_el_nd_<visibilitynode>->set_attribute(

EXPORTING

name = `VISIBLE`

value = '01' ). "Invisible

endif.

Former Member
0 Kudos

Hi,

Have a context attribute DISPLAY_TABLE type WD_BOOLEAN and map this to the table property VISIBLE.

Now just change the context attribute DISPLAY_TABLE value to X or SPACE based on the number of records in the table. Sample code is below.

if table_data is not initial.
  node_ref->set_attribute( name = 'DISPLAY_TABLE' value = 'X').
endif.

Regards,

Manne.