cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to show / hide Web Dynpro Abap table column dynamically?

Former Member
0 Kudos

Hi,

Is it possible to show / hide Web Dynpro Abap table column dynamically?

I want to hide / show column of a table.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

former_member213957
Participant
0 Kudos

Hi fikret, 

follow the steps:

1. get the table from the root->view->get_element('table').

2. get the column from lr_table->get_column('col_id').

3.change visibility value as per your condition like   

lr_column->set_visibility( '02'). or '01' 

thanks & regards,

kishorekumar SVS

Former Member
0 Kudos

Thank you for your reply.

Your solution helped me a lot.But I want to use it at button click action.I cant get "view" on the actions.( root->view->get_element('table').)Any solution for this ?

Thank you.

former_member213957
Participant
0 Kudos

Hi Fimret,

At the action level , visibility property is possible only by attribute mapping.

create attribute type of wdui_visibility in the context , bind this attribute to visibility property of table column.Fill the values as per your condition as '01' or '02'.

I hope solved your problem.

thanks & regards,

Kishorekumar SVS

0 Kudos

Hi Fikret,

1. Define an attribute of type WDUI_VISIBILITY as one of the attribute in table node . i.e     Context node which is binded with data source property of Table.

2. Bind this attribute with the visible property of the respective column which u want to hide.

3. For the first time before displaying the table, at the time binding/appending other values to table,

    make this attribute value as '02' = Visible.

4.On particular action if u want to hide the column, do the below mentioned points on action

        i) get the table

        ii) modify the visible attribute value = '01'

       iii) bind the table to the node and display

  

By doing so, you will be able hide the column(s) at runtime.

Hope it will be helpful.

Thankyou.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

Simply bind the visibility of your table column with an attribute of type bool.

Use 'Set' method to fill the value in that attribute as per your scenario. i.e. if needs to display then set value as 'X' or else set it as ' '.

Regards,

Keshav

former_member221367
Participant
0 Kudos

Hi Fikret ,

1. Define an attribute of WDY_BOOLEAN type in context node.

2.Map this attribute with table column on which u want to set visibility.

3 .Set visibility at condition where u want to show this column by set attribute as 'X'.

Former Member
0 Kudos

Hi,

For table column visiblity property assoicate context attribute of type visibility; dynamically code for showing or hiding the column

Former Member
0 Kudos

It is possible,  1. Create an attribute in the view context type 'WDY_BOOLEAN'. Lets say your node called hidenode and the attribute hideattribute   2. Select the column which you want to hide.  3. In the properities of this column there is a filed called 'visible'  4 Click on the yellow button on the right of this visible field. 5. Bind it with the attribute that you created in the first step.  6. You can now hide or show this column  7. Just write these codes in an action (maybe a button called 'Hide Column' and another button 'Show Column')    The below code will hide your column 

DATA lo_nd_context TYPE REF TO if_wd_context_node.

   DATA lo_el_element TYPE REF TO if_wd_context_element.

   DATA lv_hide_column TYPE wd_this->[enter your node]-[enter your attribute].

  "like  DATA lv_hide_column TYPE wd_this->hidenode-hideattribute."

*   navigate from <CONTEXT> to <AYLAR> via lead selection

   lo_nd_context = wd_context->get_child_node( name = wd_this->wdctx_[enter your node] ).

   lo_el_element = lo_nd_context->get_element( ).

   lo_el_element->set_attribute(

   name `[enter your attribute]`

   value = ABAP_FALSE ).

Former Member