Saturday, March 10, 2012
If you remember properly sub screen usage in ABAP dialog programming, we can co-relate Web Dynpro ViewContainer UI element to Sub screen. In dialog programming, We create screen as sub screen and we define sub screen area on main screeen. Call subscreen in the main screen.

ViewContainerUIElement is an area within a view that contains another view.
Uses 
View positioning: Flexible design of view assemblies within the browser window.
Application performance: The Web Dynpro runtime environment uses the visibility property of the ViewContainerUIElement to reduce the layout data sent to the client. Using the ViewContainerUIElement in this way can improve application performance.

Fundamental principle to use ViewContainerUIElement
  • Create one main View
  • Define View Container area using ViewContainerUIElement
  • Create one more view to embed into View Container
  • Embed second view using Drag and Drop method. 
Example
  • Create Web Dynpro Component and Save it as local object. 
  • Go to View MAIN_V -> Go to Context tab -> Create node N1 and include few attributes as shown in the screen. 
  • Go to Layout tab ->Change Layout type of ROOTUIELEMENTCONTAINER to MatrixLayout.
  • Create VIEW_CONTAINER_UIELEMENT ->Change Layout data to MatrixHeadData
  • Create GROUP element -> Change Layout to GridLayout & Layout Data to MatrixHeadData
  • Create TextView elements -> Bind with Context node N1 as shown below. 
  • Go to Methods tab -> Write below code in WDDOINIT method. 
  • METHOD wddoinit .
      DATA lo_nd_n1 TYPE REF TO if_wd_context_node.
      DATA lo_el_n1 TYPE REF TO if_wd_context_element.
      DATA ls_n1    TYPE wd_this->element_n1.
    
    *   navigate from <context> to <n1> via lead selection
      lo_nd_n1 = wd_context->get_child_node( name = wd_this->wdctx_n1 ).
    *   get element via lead selection
      lo_el_n1 = lo_nd_n1->get_element( ).
      SELECT SINGLE *
        FROM pa0002
        INTO CORRESPONDING FIELDS OF ls_n1.
    
    *   set all declared attributes
      lo_el_n1->set_static_attributes(
         static_attributes = ls_n1 ).
    
    ENDMETHOD.
    
  • Create one more view SEC_V->Create one PAGE_HEADER element. 

  • Embed SEC_V view to into View Container as shown below. 
  • Create Web Dynpro application and save it as local object. 
  • Run Web Dynpro application . 

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.