首页 > 代码库 > webdynpro 下拉列表控件

webdynpro 下拉列表控件

  1. 现在界面上添加下拉列表的控件DropDownByKey
  2. 在context中创建新的node,和属性DP
  3. 返回界面,绑定DP到控件DropDownByKey的SelectedKey

初始方法中代码如下:

*下拉菜单
  DATA lo_nd_drop TYPE REF TO if_wd_context_node.
  DATA lo_el_drop TYPE REF TO if_wd_context_element.
  DATA ls_drop TYPE wd_this->Element_drop.

  data lo_nd_if_drop TYPE REF TO IF_WD_CONTEXT_NODE_INFO.
  data lt_value_set TYPE TABLE OF WDR_CONTEXT_ATTR_VALUE.
  data ls_value_set type WDR_CONTEXT_ATTR_VALUE.
  lo_nd_drop = wd_context->get_child_node( name = wd_this->wdctx_drop ).
  CALL METHOD LO_ND_DROP->GET_NODE_INFO
    RECEIVING
      NODE_INFO = lo_nd_if_drop.

ls_value_set-value = http://www.mamicode.com/1.
ls_value_set-text = 江苏.
append ls_value_set to lt_value_set.

ls_value_set-value = http://www.mamicode.com/2.
ls_value_set-text = 上海.
append ls_value_set to lt_value_set.

  CALL METHOD LO_ND_IF_DROP->SET_ATTRIBUTE_VALUE_SET
    EXPORTING
      NAME      = DP
      VALUE_SET = lt_value_set

预览: