组件ALV处理:
DATA: lo_node TYPE REF TO if_wd_context_node,
ls_temp TYPE REF TO if_wd_context_element,
lt_temp LIKE TABLE OF ls_temp.
DATA ls_data TYPE wd_this->element_data.
DATA lt_data TYPE TABLE OF wd_this->element_data.
lo_node = wd_context->get_child_node( name = wd_this->wdctx_data ).
lt_temp = lo_node->get_selected_elements( ).
lo_node->get_static_attributes_table( IMPORTING table = lt_data ).
CHECK NOT lt_temp[] IS INITIAL.
LOOP AT lt_temp INTO ls_temp.
CALL METHOD ls_temp->get_static_attributes
IMPORTING
static_attributes = ls_data. "获取的是ALV组件中选择的单号数据
ENDLOOP.
Table控件处理:
DATA: lt_selected_elements TYPE wdr_context_element_set,
lo_selected_elements TYPE REF TO if_wd_context_element.
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lt_node TYPE wd_this->elements_node.
DATA ls_node TYPE wd_this->element_node.
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lt_selected_elements = lo_nd_node->get_selected_elements( abap_true ).
LOOP AT lt_selected_elements INTO lo_selected_elements.
lo_selected_elements->get_static_attributes( IMPORTING static_attributes = ls_node ).
lo_nd_node->remove_element( lo_selected_elements ). 删除选中的行
ENDLOOP.