Skip to end of metadata
Go to start of metadata

Create a new Webdynpro application.

In the main view create a LINK. In the link  properties give text as CLICK and under events (onAction) give CLICK as event name .

Double click on event name ie CLICK and a method would get created called ONACTIONCLICK which is of type Event Handler.


Then create a TRAY


Then under the node of TRAY create a VIEWCONTAINERUIELEMENT

Now the view will look like this


Create a new View


Now in View1 create a label


Similarly create another view by name VIEW2 and create a label in the layout as view2

and view2 would look like this


Now Drag and drop the VIEW1 and VIEW2 under V1 container. Were embedding the views in the view container.

Now create outbound plugs for MAIN

and inbound plugs for VIEW1 and VIEW2 .


 Now in the Context create an attribute w_i of type i to hold a value.

Under windows create navigation links .

Outbound plugs name to_view1 right click on it and create navigation link and select view1. Similarly for outbound plug to_view2 , select  view2.

Now in the MAIN view go to methods tab and double click on method ONACTIONCLICK.
  DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
  DATA lv_w_i LIKE ls_context-w_i.
* get element via lead selection
  lo_el_context = wd_context->get_element(  ).
* get single attribute
      name =  `W_I`
      value = lv_w_i ).
if lv_w_i eq 0.
  lv_w_i = lv_w_i + 1.
  CALL METHOD lo_el_context->set_attribute
      value  = lv_w_i
      name   = 'W_I'   .


When you click once view1 will be displayed
when you click again view2 will be displayed

So in this way we can make the view appear conditionally

  • No labels