SAP Tech Pro

SAP Technical Blog
Topprice Price Comparison

How to use “ContextualPanel” Web Dynpro UI element with Static and Dynamic Programming

How to use “ContextualPanel” Web Dynpro UI element with Static and Dynamic Programming

The UI element ContextualPanel offers navigation functions. Its navigation list can have many levels.We create the same example as for the PageHeader,but, in this case,we use the two LinkTo Action UIElements to create the content for a ContextualPanel UI element.

In a contextualPanel UI element, we can insert three types of elements: Free- ContextualArea,NavigationList and ViewSwitch. In our example,we have used two FreeContextualArea elements.

In a FreeContextualArea, we can insert a Content and a Header. We can set the header to be expandable or no. The Content is a zone where we can insert other UI elements we want to be displayed within the FreeContextualArea (Fig.)

FreeContexualArea

How to use “ContextualPanel” Web Dynpro UI element with Static and Dynamic Programming

V_VIEW view Layout

How to use “ContextualPanel” Web Dynpro UI element with Static and Dynamic Programming

V_VIEW view Layout

How to use “ContextualPanel” Web Dynpro UI element with Static and Dynamic Programming

Dynamic Programming

RUNTIME CLASS: CL_WD_CONTEXTUAL_PANEL

For the ContextualPanel UI element, we have, as aggregation, the items: Free- ContextualArea,
ViewSwitch and NavigationList elements.
The FreeContextual- Area runtime class is
CL_WD_FREE_CONTEXTUAL_AREA.

The implementation of a dynamic contextualPanel UI element,with a Free- ContextualArea element that has a Content(linkToAction UI element)and a Header(expandableTitle element),contains the following statements (Listing ):

Dynamic programming of a contextualPanel UI element


METHOD wddomodifyview.

DATA lr_flow_data TYPE REF TO cl_wd_flow_data.

DATA lr_container TYPE REF TO cl_wd_uielement_container.

DATA lr_contextualpanel TYPE REF TO cl_wd_contextual_panel.

DATA lr_freecontextualarea TYPE REF TO cl_wd_free_contextual_area.

DATA lr_linktoaction TYPE REF TO cl_wd_link_to_action.

DATA lr_header TYPE REF TO cl_wd_expandable_title.

IF first_time EQ abap_true.

lr_container ?= view->get_element('ROOTUIELEMENTCONTAINER').

lr_contextualpanel = cl_wd_contextual_panel=&g new_contextual_panel(

id = 'CP_CONTEXTUALPANEL'

).

lr_freecontextualarea = cl_wd_free_contextual_area=>new_free_contextual_ar

ea(

id = 'FREECONTEXTUALAREA_1'

).

lr_flow_data = cl_wd_flow_data=>new_flow_data(element =

lr_contextualpanel).

lr_container->add_child(lr_contextualpanel).

lr_linktoaction = cl_wd_link_to_action=>new_link_to_action(

id = 'CONTENT_1'

on_action ='SHOW_COUNTRIES'

text ='Show EU countries'

).

lr_freecontextualarea->set_content(the_content = lr_linktoaction).

lr_header = cl_wd_expandable_title=>new_expandable_title(

id ='EXPANDABLETITLE_1'

expandable = abap_true

expanded = abap_true

title ='COUNTRY'

).

lr_freecontextualarea->set_header(the_header = lr_header).

lr_contextualpanel->add_item(the_item = lr_freecontextualarea).

ENDIF.
 

Add comment

Before Buying, Compare Prices at Topprice.in

Topprice.in