Chinaunix首页 | 论坛 | 博客
  • 博客访问: 691029
  • 博文数量: 145
  • 博客积分: 3446
  • 博客等级: 中校
  • 技术积分: 1567
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-30 13:58
文章分类

全部博文(145)

文章存档

2021年(1)

2020年(1)

2019年(1)

2018年(6)

2017年(1)

2016年(10)

2015年(12)

2014年(10)

2013年(15)

2012年(33)

2011年(21)

2010年(9)

2009年(18)

2008年(2)

2006年(5)

我的朋友

分类:

2011-04-22 17:06:32

访问一个node element
获得一个指向node的引用后就可以使用get_element( )方法来获得指向element at selection的引用,类型为IF_WD_CONTEXT_ELEMENT。

DATA: lo_nd_flights TYPE REF TO lf_wd_context_node.
DATA: lo_el_flights  TYPE REF TO if_wd_context_element.

lo_wd_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).

*get element at lead selection
lo_el_flight = lo_flight_flights->get_element( ).

*if lead selection is not set, ELEM_FLIGHTS will be initial
IF ( lo_el_flights IS INITIAL ).
...
ENDIF.

要获得索引为n的element,使用方法get_element( index = n )。get_element_count( ) 方法返回一个collection中的element的数目。

访问单个node的attribute
一旦获得了指向一个node element的引用,就可以使用下面两个方法来访问这个node的attribute。get_attribute( )可以访问任意一个attribute,所需的参数是要访问的attribute的名字。另一个方法是get_static_attributes( ),用于访问static defined attributes(此处不明白)。

DATA: lo_nd_flights TYPE REF TO lf_wd_context_node.
DATA: lo_el_flights  TYPE REF TO if_wd_context_element.
DATA: lv_connid TYPE wd_this->element_flights-connid.

lo_wd_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).
lo_el_flight = lo_flight_flights->get_element( ).

*get single attribute
lo_el_flights->get_attribute(
EXPORTING
name = 'CONNID'
IMPORTING
value = lv_connid ).

controller context中的每个node在interface IF_中都有一个隐含的名为element_structure和名为elements_的standard internal table,其line type是element_。这个internal table用于存放multiple node elements的attributes。(此处不明白,既然每个node都有一个这样对应的internal table,为什么还说存放multiple node elements的attributes??)

一个使用get_static_attributes( )访问一个node 的static attributes的例子:
DATA: lo_nd_flights TYPE REF TO lf_wd_context_node.
DATA: lo_el_flights  TYPE REF TO if_wd_context_element.
DATA: ls_flights TYPE wd_this->element_flights.

lo_nd_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).
lo_el_flights = lo_nd_flights->get_elements

*get all static declared attributes
lo_el_flights->get_static_attributes(
IMPORTING
static_attributes = ls_flights ).

获取所有node elements的static attribues:

DATA: lo_nd_flights TYPE REF TO lf_wd_context_node.
DATA: lt_flights TYPE wd_this->element_flights.

lo_nd_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).

*get all static declared attributes for all node element
lo_nd_flights->get_static_attributes_table(
IMPORTING
table = lt_flights ).

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/chfeijj/archive/2009/12/29/5100171.aspx

阅读(1022) | 评论(0) | 转发(0) |
0

上一篇:Using MVC for BSP

下一篇:report

给主人留下些什么吧!~~