cancel
Showing results for 
Search instead for 
Did you mean: 

How can i deactivate a view

Former Member
0 Kudos
96

How can i deactivate or make a view invisible dynamically based on and input parameter coming from an RFC. Please advice.

Thanks,

Suri

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member189058
Active Contributor
0 Kudos

Hi Suri,

Use a view container in your main view and embed this view(the one in which you have to set visibilty dynamically) in the view container.

Now cerate a attribute of type visibilty in the context.

Depending on your condition, set this attribute to visible or none in the code whereever you have to handle visibilty.

Bind this attribute to the visibity property of the view container.

Regards

Reema.

Former Member
0 Kudos

Thanks Koen and Reema. i have understood the solution. can anyone of you provide me the code for this.

Former Member
0 Kudos

hi,

use the magic wand button in se80 to read context attribute (just select in the tree structure of the context)

and use elem->set_attribute( exporting name = 'name'

value = abap_false ).

instead of the get_attribute that is suggested in the code suggestion

grtz,

Koen

Former Member
0 Kudos

Hi Suri,

In your context, have an attribute 'view_visible' of type char01.

In the wddoinit method of your view, put the following code to make the view visible initially.

data: elem_context type ref to if_wd_context_element.

elem_context = wd_context->get_element( ).

elem_context->set_attribute(

exporting

name = 'VIEW_VISIBLE'

value = abap_true

).

In the event handler where you want to set the view as invisible, just put the same coding setting the attribute as False. Bind this attribute to the 'Visible' property of the view container. You can see in the properties tab.

Regards

Nithya

Former Member
0 Kudos

Thank you very much Koen that works.

Thanks for the answer Nithya.

Former Member
0 Kudos

Hi Suri,

no problem

grtz,

Koen

PS: <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/crphelp#poster">Saying thanks on SDN</a>

Former Member
0 Kudos

hi,

you can set an attribute in your context type wdy_boolean

and depending on the importing parameters you can set it to abap_true abap_false,

bind that attribute to the visible attribute of the view ui element where the view is in

grtz,

Koen