cancel
Showing results for 
Search instead for 
Did you mean: 

How to set properties of table(node) at run time.

Former Member
0 Kudos

Hello All,

I am displaying a table using webdynpro, this table has say 10 columns, Now when user clicks on a buttion i need to hide five fields (columns) of the table and display remaining 5 fields(columns).

what steps/code i should follow in the onaction of the buttion?

i tried to use SET_ATTRIBUTE_PROPS_FOR_NODE and SET_ATTRIBUTE_PROPS_FOR_ELE also but didnt get the result, or how to use these methods correctly?

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Ramanuja,

The TableColumn UI element has a property, visible, which you can bind to a context attribute of type WDY_BOOLEAN. Upon click of your button, you could change the value of the bound attribute to either abap_true or abap_false using method IF_WD_CONTEXT_NODE->SET_ATTRIBUTE.

Cheers,

Amy

Former Member
0 Kudos

Hello Amy King

Thanks for the reply, But here i want to have more similar buttions, upon clicking on each buttion some columns has to dispaly and some columns has to hide, its some thing like layout variant in alv,

in that case i can not bound certain value to the context attribute.

so i want bind the visible property in the method itself, pls suggest if there is any other way?

amy_king
Active Contributor
0 Kudos

Hi Ramanuja,

"in that case i can not bound certain value to the context attribute."

I'm not sure I understand why the approach doesn't fit your requirement. Let's say you create a context node, VISIBLE, and add to it one attribute for each column in your table. Next, bind each TableColumn.visible property to its corresponding context attribute. Then in the action handler for each button, you can set the individual TableColumns to be visible or hidden as needed according to the "layout variant" you want to display.

Cheers,

Amy

Former Member
0 Kudos

Yes, your answer is correct & helpful,this will work, I will close the thread.

But I have nearly 90 attributes....Thats why i want to avoid creating visible node and bind individual attributes with visible property. I want to handle this in program.

amy_king
Active Contributor
0 Kudos

Hi Ramanuja,

You can use this approach in different ways. I imagine you can reuse certain context attributes for more than one TableColumn according to how many "layout variants" you have and which columns show or hide in each variant. You just need to analyze which columns display when.

However, if a dynamic solution is preferable for your scenario, you can still do so by getting an instance of each TableColumn (which uses runtime class CL_WD_TABLE_COLUMN) and calling method CL_WD_TABLE_COLUMN->SET_VISIBLE. The parameter for this method is of type WDUI_VISIBILITY. Here's the documentation for TableColumn.

Cheers,

Amy

Former Member
0 Kudos

Thanks a lot its solved

Answers (0)