SAP Tech Pro

SAP Technical Blog
Topprice Price Comparison

Web Dynpro - Example of Tree Control

Web Dynpro - Example of Tree Control

Web Dynpro - Example of Tree Control

 

Web Dynpro Component “DemoTree” explains how to display a Tree control.

 

Insert Tree UI element into the view and complete the properties of the Tree, TreeNode Type and TreeItem Type as shown below:

Web Dynpro - Example of Tree Control

Create the Nodes in the context and use the supply function to fill the data as shown below :

Web Dynpro - Example of Tree Control

 

Fill the TreeNode type with the data:


method supply_motor_kinds .

data: kinds type wdr_name_value_list.

data: kind type wdr_name_value.

kind-name = 'K01'.
kind-value = text-k01.
append kind to kinds.

kind-name = 'K02'.
kind-value = text-k02.
append kind to kinds.

node->bind_table( kinds ).

endmethod.

Fill the TreeItem type data based on the Node type selected :


method supply_motor_type .

data: types type wdr_name_value_list,
      kind type string.

parent_element->get_attribute( exporting name = 'NAME' importing value = kind ).

  data: motor_type type wdr_name_value.

case KIND.

when 'K01'.
  motor_type-name = 'T11'.
  motor_type-value = text-t11.
  append motor_type to types.

  motor_type-name = 'T12'.
  motor_type-value = text-t12.
  append motor_type to types.

when 'K02'.
  motor_type-name = 'T21'.
  motor_type-value = text-t21.
  append motor_type to types.

  motor_type-name = 'T22'.
  motor_type-value = text-t22.
  append motor_type to types.

  motor_type-name = 'T23'.
  motor_type-value = text-t23.
  append motor_type to types.
endcase.
node->bind_table( types ).


endmethod.

 

Output:

image

Add comment

Before Buying, Compare Prices at Topprice.in

Topprice.in