web dynpro for abap基础知识(4)(转)
来源:互联网 发布:tensorflow 0.11 whl 编辑:程序博客网 时间:2024/05/29 09:34
访问一个context node
对于每一个controller,系统都会为其自动创建一个interface,名为IF_<ctrol_name>。在这个interface中,对于每一个context node都会有一个相应的WDCTX_<node_name>存在。访问root node直接使用WD_CONTEXT,访问root node的子node使用get_child_node( )方法,要注意的是方法名作为参数被传递时必须是大写!方法返回指向指定node的引用,类型为IF_WD_CONTEXT_NODE。这个方法还有一个可选参数,是要访问的element在父node中的索引编号。
访问一个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 selectionlo_el_flight = lo_flight_flights->get_element( ).
*if lead selection is not set, ELEM_FLIGHTS will be initialIF ( 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 attributelo_el_flights->get_attribute(EXPORTINGname = 'CONNID'IMPORTINGvalue = lv_connid ).
controller context中的每个node在interface IF_<ctrl_name>中都有一个隐含的名为element_<node_name>structure和名为elements_<node_name>的standard internal table,其line type是element_<node_name>。这个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 attributeslo_el_flights->get_static_attributes(IMPORTINGstatic_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 elementlo_nd_flights->get_static_attributes_table(IMPORTINGtable = lt_flights ).
- web dynpro for abap基础知识(4)(转)
- web dynpro for abap基础知识(2)
- web dynpro for abap 基础知识(一)
- web dynpro for abap 基础知识(二)
- web dynpro for abap基础知识(三)
- web dynpro for abap基础知识(四)
- web dynpro for abap基础知识(3)(转)
- web dynpro for abap 基础知识
- web dynpro for abap
- Web Dynpro for ABAP:URL of a Web Dynpro Application
- web dynpro for abap bapi的使用
- Web Dynpro for ABAP SELECT OPTIONS
- SAP web dynpro for abap 环境配置
- Web dynpro for ABAP ALV 相关知识
- Web Dynpro 基础知识(一)(转)
- Web Dynpro for ABAP 之 Web Dynpro Window& Web Dynpro Application
- Web Dynpro ABAP (SAP主页)
- Web Dynpro ABAP Configuration
- web dynpro for abap基础知识(3)(转)
- Windows群集开发-编写微软群集服务器(MSCS)资源DLL:9)线索和更多信息
- uC/OS-II的任务调度与时钟
- JPA中关系印射注意事项
- RedFlag linux 6 SP! No Screens Found问题解决方法
- web dynpro for abap基础知识(4)(转)
- 内网渗透---获取管理员密码 几种方式
- (转自ITAA)全面分析IT人为什么难以拿到高薪
- 孙立人:歼灭日军最多的中国将领
- apr内存池
- 网站配色,CSS主色调配色方案
- 免费迷你书下载:硝烟中的Scrum和XP
- 软件企业通常会犯"近视"和"远视"两个错误
- Reporting Services Handscript