1.6 Component Usage(Select Options)
本实例如何使用Component组件SELECT_OPTIONS。在实际应用都是多个Web Dynpro Component组成的。可以直接在之前基础上操作,也可以新建一个项目。
1.Web Dynpro Component:Z_TEST_WDA2创建Component Use。
选择FLIGHTLISTVIEW视图组件,点击Create Controller Usage
选择Component Use为SELECT_OPTIONS的
修改Context页签
创建FLIGHT上下文节点,
修改Attributes页签
创建变量M_HANDLER,类型:IF_WD_SELECT_OPTIONS;
创建变量M_WD_SELECT_OPTIONS,类型:IWCI_WDR_SELECT_OPTIONS;
修改Layout页签
创建GROUP类型视图控件GROUP3;
创建ViewContianerUIElement类型视图控件,这个控件可以用来显示Compnent组件的视图View。这里用来显示SELECTION_OPTION。
创建BUTTON按钮类型视图控件BTN1,点击按钮获取SELECTION_OPTION值,根据条件查询flight。Action:FIND,自动生成Method:ONACTIONFIND方法。
创建TABLE类型视图控件TABLE1,显示查询出来的flight信息。
右键TABLE1控件->Creat Binding
修改Methods页签,
重写WDDOINIT方法,初始化SELECT_OPTIONS。
method WDDOINIT .
data:lt_range_table type ref to data,
rt_range_table type ref to data,
read_only type abap_bool,
typename type string.
data:lr_componentcontroller type ref to ig_componentcontroller,
l_ref_cmp_usage type ref to if_wd_component_usage.
* create the used component
l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
* get a pointer to the interface controller of the select options *component
wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
* init the select screen
wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
* create a range table that consists of this new data element
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CARR_ID' ).
* add a new field to the selection
wd_this->m_handler->add_selection_field(
i_id = 'S_CARR_ID'
it_result = lt_range_table
i_read_only = read_only ).
* create a range table that consists of this new data element
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CONN_ID' ).
* add a new field to the selection
wd_this->m_handler->add_selection_field( i_id = 'S_CONN_ID'
it_result = lt_range_table
i_read_only = read_only ).
endmethod.
重写ONACTIONFIND方法,通过获取SELECT_OPTIONS值,作为条件查询flight信息。
method ONACTIONFIND .
data: node_flights type ref to if_wd_context_node.
data: rt_carrid type ref to data.
data: rt_connid type ref to data.
data: t_flight type table of sflight.
field-symbols: <fs_carrid> type table,
<fs_connid> type table.
* Retrieve the data from the select option
rt_carrid = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'S_CARR_ID' ).
* Assign it to a field symbol
assign rt_carrid->* to <fs_carrid>.
* Retrieve the data from the select option
rt_connid = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'S_CONN_ID' ).
* Assign it to a field symbol
assign rt_connid->* to <fs_connid>.
* Retrieve that data from the database. Normally it is suggested to
* encapsulate the data retrieval in a separate class.
* For simplicity, the SELECT statement has been implemented here.
select * into corresponding fields of table t_flight from sflight
where carrid in <fs_carrid>
and connid in <fs_connid>.
* Bind the data to the context
node_flights = wd_context->get_child_node( name = `FLIGHT` ).
node_flights->bind_elements( t_flight ).
endmethod.
2.设置Window,将SELECTION_OPTION组件视图放入VIEW1
选择点击F4帮助小方块,找到SELECT_OPTIONS的VIEW屏幕
3.运行Web Dynpro Application,使用Selection options,点击find按钮。
Select Options组件详解
Select Options对应接口IF_WD_SELECT_OPTIONS对象select_handler,通过这个对象配置操作Select Options。
1.获取IF_WD_SELECT_OPTIONS接口对应对象;
初始化component组件
data:lr_componentcontroller type ref to ig_componentcontroller,
l_ref_cmp_usage type ref to if_wd_component_usage.
* create the used component
l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
获取IF_WD_SELECT_OPTIONS接口对应对象wd_this->m_handler;
* get a pointer to the interface controller of the select options *component
wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
* init the select screen
wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
2. IF_WD_SELECT_OPTIONS接口方法;
ADD_SELECTION_FIELD方法:添加select参数;
ADD_SELECTION_FIELDS方法:添加多个select参数;
GET_SELECTION_FIELD方法:获取select参数;
GET_SELECTION_FIELDS方法:获取select参数;
UPD_SELECTION_FIELD方法:更新select;
RESET_ALL_SELECTION_FIELDS方法:重置所有select参数;
RESET_SELECTION_FIELD方法:重置指定id的select参数;
CHECK_ALL_SELECTION_FIELDS方法:check所有select参数;
参数:
I_ID:select参数唯一识别标志;
I_DESCRIPTION:select参数描述;
I_WITHIN_BLOCK:ID of Enclosing Block;
I_IS_AUTO_DESCRIPTION:是否自动描述,默认为True;
IT_RESULT:结果内表,用来保存用户选择值,这个参数必须有;
I_OBLIGATORY:是否必输,默认为False;
I_VALUE_HELP_TYPE:指定help类型,
IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_SEARCHHELP;
IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_OVS,OVS帮助类型;
IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_APPLDEV;
IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_AUTO;
IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE;
IF_WD_VALUE_HELP_HANDLER=>CO_VH_TYPE_NO_HELP,no input help;
IF_WD_VALUE_HELP_HANDLER=>CO_VH_TYPE_BACKEND,类型DDIC、QVS;
IF_WD_VALUE_HELP_HANDLER=>CO_VH_TYPE_CLOCK,类型时钟;
IF_WD_VALUE_HELP_HANDLER=>CO_VH_TYPE_CALENDAR,类型日历;
IF_WD_VALUE_HELP_HANDLER=>CO_VH_TYPE_VALUESET,值集;
I_VALUE_HELP_ID:help帮助唯一标识;
I_VALUE_HELP_MODE:help帮助模式,
I_VALUE_HELP_STRUCTURE:f4 help帮助对应table;
I_VALUE_HELP_STRUCTURE_FIELD:f4 help帮助对应字段;
I_HELP_REQUEST_HANDLER:handler for f4 help;
I_LOWER_CASE:是否允许小写;
I_MEMORY_ID:Memory ID for Default Value;
I_NO_EXTENSION:No Multiple Selection,默认为False;
I_NO_INTERVALS: No Intervals (Single Values Only),默认为False;
I_AS_CHECKBOX:显示为check box;
I_AS_DROPDOWN:显示为下拉选择;
IT_VALUE_SET:下拉选择值内表,类型WDY_KEY_VALUE_TABLE,注意这是一个有序且key值唯一的内表;
I_READ_ONLY:是否只读,默认False;
I_DONT_CARE_VALUE:忽略的初始值表;
I_EXPLANATION: Explanation;
I_TOOLTIP: Quick Info;
I_IS_NULLABLE:是否允许空值;
I_FORMAT_PROPERTIES:参数格式;
CREATE_RANGE_TABLE方法:创建Range Table
GET_RANGE_TABLE_OF_SEL_FIELD方法: 返回结果Range Table,选择的select值内表;
SET_RANGE_TABLE_OF_SEL_FIELD:设置结果Range Table,select内表,可以用来重置结果表;
ADD_PARAMETER_FIELD方法:添加Parameter;
ADD_PARAMETER_FIELDS方法:添加多个Parameter;
GET_PARAMETER_FIELD方法:获取Parameter;
GET_PARAMETER_FIELDS方法:获取Parameter;
SET_VALUE_OF_PARAMETER_FIELD方法:设置parameter值;
GET_VALUE_OF_PARAMETER_FIELD方法:获取parameter值;
RESET_PARAMETER_FIELD方法:重置Parameter值;
RESET_ALL_PARAMETER_FIELDS方法:重置所有Parameter值;
CHECK_ALL_PARAMETER_FIELD方法:Check所有Parameter值;
参数:
I_VALUE:Parameter值;
ADD_HORIZONTAL_DIVIDER方法:添加水平线;
ADD_HORIZONTAL_DIVIDERS方法:添加多个水平线;
GET_HORIZONTAL_DIVIDER方法:获取水平线;
GET_HORIZONTAL_DIVIDERS方法:获取水平线;
参数:
I_ID:唯一标识;
I_WITHIN_BLOCK:ID of Enclosing Block;
ADD_TEXT_LINE方法:添加文本线;
ADD_TEXT_LINES方法:添加多个文本线;
GET_TEXT_LINE方法;
GET_TEXT_LINES方法;
I_ID:唯一标识
I_WITHIN_BLOCK:ID of Enclosing Block;
I_TEXT:文本;
I_DESIGN:默认CL_WD_TEXT_VIEW=>E_DESIGN-STANDARD
IT_TEXT_LINES方法:添加多个文本线;
ADD_BLOCK方法:添加块;
ADD_BLOCKS方法:添加多个块;
GET_BLOCK方法;
GET_BLOCKS方法;
I_ID:唯一标识;
I_WITHIN_BLOCK:ID of Enclosing Block;
I_BLOCK_TYPE:默认MC_BLOCK_TYPE_GROUP;
I_TITLE:Block标题;
I_HIDE_IF_EMPTY:是否隐藏,如果block为空,默认False;
I_WIDTH:默认’100%’;
I_STRETCHED_HORIZONTALLY:默认为True;
ADD_SELECTION_SCREEN_ITEM方法:添加slection screen;
ADD_SELECTION_SCREEN_ITEMS方法;
GET_SELECTION_SCREEN_ITEM方法;
GET_SELECTION_SCREEN_ITEMS方法;
REMOVE_SELECTION_SCREEN_ITEM方法;
REMOVE_ALL_SEL_SCREEN_ITEMS方法;
CHECK_SELECTION_SCREEN方法;
SET_GLOBAL_OPTIONS方法:设置全局功能;
参数:
I_DISPLAY_BTN_CANCEL:是否显示Cancel按钮;
I_DISPLAY_BTN_CHECK:是否显示Check按钮;
I_DISPLAY_BTN_RESET:是否显示Reset按钮;
I_DISPLAY_BTN_EXECUTE:是否显示Execute按钮;
3.创建Select option,下拉选择框,Parameter,Checkbox等;
示例代码:
DATA:lt_range_table type ref to data.
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CARR_ID' ).
"创建select option
wd_this->m_handler->add_selection_field(
i_id = 'ID_CARR_ID' "id
i_description = '航班ID' "描述
it_result = lt_range_table "结果内表
i_obligatory = abap_true "是否必输
i_value_help_structure = 'SFLIGHT' "help表结构
i_value_help_structure_field = 'CARRID' "help航班字段
).
"下拉选择内表
DATA:lt_value_set TYPE wdy_key_value_table.
DATA:ls_value_set LIKE LINE OF lt_value_set.
"下拉值
ls_value_set-key = '0002'.
ls_value_set-value = '0002'.
APPEND ls_value_set TO lt_value_set.
ls_value_set-key = '0005'.
ls_value_set-value = '0005'.
APPEND ls_value_set TO lt_value_set.
ls_value_set-key = '0017'.
ls_value_set-value = '0017'.
APPEND ls_value_set TO lt_value_set.
ls_value_set-key = '0555'.
ls_value_set-value = '0555'.
APPEND ls_value_set TO lt_value_set.
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CONN_ID' ).
"创建dropdown
wd_this->m_handler->add_selection_field(
i_id = 'ID_CONN_ID'
i_description = 'Conn. ID'
it_result = lt_range_table
i_as_dropdown = abap_true
it_value_set = lt_value_set
i_read_only = abap_false ).
"设置默认下拉默认值
TYPES:BEGIN OF s_range_default,
sign TYPE char1,
option TYPE char2,
low TYPE S_CONN_ID,
high TYPE S_CONN_ID,
END OF s_range_default.
FIELD-SYMBOLS:<fs_default> TYPE TABLE.
DATA:lt_default TYPE REF TO DATA.
DATA:wa_default TYPE s_range_default.
"设置默认值
CREATE DATA lt_default TYPE TABLE OF s_range_default.
ASSIGN lt_default->* TO <fs_default>.
wa_default-low = '0002'.
wa_default-option = 'EQ'.
wa_default-sign = 'I'.
APPEND wa_default TO <fs_default>.
wd_this->m_handler->SET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'ID_CONN_ID' IT_RANGE_TABLE = lt_default ).
"创建select option,no interval,no extension
"PLANETYPE
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_PLANETYE' ).
wd_this->m_handler->add_selection_field(
i_id = 'ID_PLANETYE'
i_description = 'Plane type'
it_result = lt_range_table
i_read_only = abap_false
i_no_extension = abap_true "是否多值输入
i_no_intervals = abap_true "是否范围输入
i_value_help_structure = 'SFLIGHT' "help表结构
i_value_help_structure_field = 'PLANETYPE' "help字段
).
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'CHAR1' ).
"创建checkbox
wd_this->m_handler->add_selection_field(
i_id = 'ID_CHECK'
i_description = 'YES/NO'
it_result = lt_range_table
i_as_checkbox = abap_true ).
DATA:lr_value TYPE REF TO DATA.
CREATE DATA lr_value TYPE SFLIGHT-FLDATE.
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_DATE' ).
"创建Parameter,日期
wd_this->m_handler->add_parameter_field(
i_id = 'ID_FLDATE'
i_description = 'Flight Date'
i_value_help_structure = 'SFLIGHT'
i_value_help_structure_field = 'FLDATE'
i_value = lr_value ).
"创建横线
wd_this->m_handler->add_horizontal_divider(
i_id = 'ID_DIV1'
).
"创建text line
wd_this->m_handler->add_text_line(
i_id = 'ID_TEXT_L1'
i_text = 'text text text text text text text text'
i_design = CL_WD_TEXT_VIEW=>E_DESIGN-HEADER1
).
"创建block
"type:mc_block_type_group;mc_block_type_tray;mc_block_type_transp_container
wd_this->m_handler->add_block(
i_id = 'ID_BLK1'
i_block_type = if_wd_select_options=>mc_block_type_group
i_title = 'BLOCK1'
i_hide_if_empty = abap_false
i_width = '100%'
i_stretched_horizontally = abap_true
).
"Set the Global options
"是否显示cancel,check,reset,execute按钮
wd_this->m_handler->set_global_options(
I_DISPLAY_BTN_CANCEL = abap_false
I_DISPLAY_BTN_CHECK = abap_false
I_DISPLAY_BTN_RESET = abap_false
I_DISPLAY_BTN_EXECUTE = abap_false ).
4.点击find按钮时,onactionfind方法,获取选择值;
示例代码:
data: node_flights type ref to if_wd_context_node.
data: rt_table type ref to data.
data: lv_fldate TYPE REF TO data.
data: t_flight TYPE TABLE OF sflight.
field-symbols: <fs_carrid> type table,
<fs_connid> type table,
<fs_planetype> TYPE table,
<fs_fldate> TYPE SFLIGHT-FLDATE,
<fs_value> TYPE table.
"获取carrid
rt_table = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'ID_CARR_ID' ).
assign rt_table->* to <fs_carrid>.
"获取connid
rt_table = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'ID_CONN_ID' ).
assign rt_table->* to <fs_connid>.
"获取planetype
rt_table = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'ID_PLANETYE' ).
assign rt_table->* to <fs_planetype>.
"获取fldate,paramter获取方式
lv_fldate = wd_this->m_handler->get_value_of_parameter_field( i_id = 'ID_FLDATE').
IF lv_fldate IS INITIAL.
DATA:lv_date TYPE D.
lv_date = sy-datum.
GET REFERENCE OF lv_date INTO lv_fldate.
assign lv_fldate->* to <fs_fldate>.
ELSE.
assign lv_fldate->* to <fs_fldate>.
ENDIF.
"获取check box值
rt_table = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'ID_CHECK' ).
assign rt_table->* to <fs_value>.
"根据选择值作为条件,筛选数据
select * into corresponding fields of table t_flight from sflight
where carrid in <fs_carrid>
and connid in <fs_connid>
and planetype in <fs_planetype>
and fldate = <fs_fldate>.
"context上下文绑定数据
node_flights = wd_context->get_child_node( name = `FLIGHT` ).
node_flights->bind_elements( t_flight ).
5.点击reset按钮时,onactionreset方法,重置选择值;
实例代码:
"重置方法
"重置所有select
"wd_this->m_handler->RESET_ALL_SELECTION_FIELDS( ).
"重置单个select
wd_this->m_handler->RESET_SELECTION_FIELD( i_id = 'ID_CARR_ID' ).
"select,重新设置结果表
DATA:lt_range_table TYPE REF TO data.
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CARR_ID' ).
wd_this->m_handler->set_range_table_of_sel_field(
i_id = 'ID_CARR_ID'
it_range_table = lt_range_table ).
"重置所有Parameter
"wd_this->m_handler->RESET_ALL_PARAMETER_FIELDS( ).
"重置单个Parameter
"wd_this->m_handler->RESET_PARAMETER_FIELD( i_id = 'ID_FLDATE' ).
DATA:lr_fldate TYPE REF TO data.
CREATE DATA lr_fldate TYPE SFLIGHT-FLDATE.
wd_this->m_handler->set_value_of_parameter_field( i_id = 'ID_FLDATE' i_value = lr_fldate ).
1.7.1问题1:使用自定义search help
1.使用se11,创建应用help的字段结构ZSFLIGHT_HELP_STRC;
2.创建search help:ZSFLIGHT_SEARCH_HELP
创建search help exit对应function:ZSFLIGHT_SEARCH_HELP
Changing参数:SHLP type:SHLP_DESCR; CALLCONTROL type:DDSHF4CTRL;
Tables参数:SHLP_TAB type:SHLP_DESCT; RECORD_TAB like:SEAHLPRES;
实例代码:
FUNCTION ZSFLIGHT_SEARCH_HELP.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCT OPTIONAL
*" RECORD_TAB STRUCTURE SEAHLPRES OPTIONAL
*" CHANGING
*" REFERENCE(SHLP) TYPE SHLP_DESCR
*" REFERENCE(CALLCONTROL) TYPE DDSHF4CTRL
*"----------------------------------------------------------------------
DATA:lt_source_tab LIKE TABLE OF sflight,
ls_shlp_tab TYPE shlp_descr,
ls_selopt TYPE ddshselopt.
DATA:lr_carrid TYPE RANGE OF sflight-carrid.
DATA:ls_carrid LIKE LINE OF lr_carrid.
DATA:lr_connid TYPE RANGE OF sflight-connid.
DATA:ls_connid LIKE LINE OF lr_connid.
DATA:lr_planetype TYPE RANGE OF sflight-planetype.
DATA:ls_planetype LIKE LINE OF lr_planetype.
IF callcontrol-step = 'SELECT'.
READ TABLE shlp_tab INTO ls_shlp_tab INDEX 1.
IF ls_shlp_tab-selopt IS NOT INITIAL.
LOOP AT ls_shlp_tab-selopt INTO ls_selopt.
CASE ls_selopt-shlpfield.
WHEN 'CARRID'.
ls_carrid-sign = ls_selopt-sign.
ls_carrid-option = ls_selopt-option.
ls_carrid-low = ls_selopt-low.
ls_carrid-high = ls_selopt-high.
APPEND ls_carrid TO lr_carrid.
WHEN 'CONNID'.
ls_connid-sign = ls_selopt-sign.
ls_connid-option = ls_selopt-option.
ls_connid-low = ls_selopt-low.
ls_connid-high = ls_selopt-high.
APPEND ls_connid TO lr_connid.
WHEN 'PLANETYPE'.
ls_planetype-sign = ls_selopt-sign.
ls_planetype-option = ls_selopt-option.
ls_planetype-low = ls_selopt-low.
ls_planetype-high = ls_selopt-high.
APPEND ls_planetype TO lr_planetype.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDIF.
SELECT * INTO TABLE lt_source_tab FROM sflight
WHERE carrid IN lr_carrid
AND connid IN lr_connid
AND planetype IN lr_planetype.
SORT lt_source_tab.
DELETE ADJACENT DUPLICATES FROM lt_source_tab.
CALL FUNCTION 'F4UT_RESULTS_MAP'
EXPORTING
source_structure = 'SFLIGHT'
apply_restrictions = ' '
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_source_tab
CHANGING
shlp = shlp
callcontrol = callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2.
IF sy-subrc = 0.
callcontrol-step = 'DISP'.
ELSE.
callcontrol-step = 'EXIT'.
ENDIF.
ENDIF.
ENDFUNCTION.
设置Search Help,CONNID,PLANETYPE设置自定义的ZSFLIGHT_SEARCH_HELP,search help。
程序添加使用自定义search help
示例代码:
"使用新的search help
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CARR_ID' ).
"创建select option
wd_this->m_handler->add_selection_field(
i_id = 'S_CARRID' "id
i_description = 'carr. id.' "描述
it_result = lt_range_table "结果内表
i_no_extension = abap_true "是否多值输入
i_no_intervals = abap_true "是否范围输入
i_value_help_structure = 'ZSFLIGHT_HELP_STRC' "help结构
i_value_help_structure_field = 'CARRID' "help字段
).
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CONN_ID' ).
"创建select option
wd_this->m_handler->add_selection_field(
i_id = 'S_CONNID' "id
i_description = 'conn. id.' "描述
it_result = lt_range_table "结果内表
i_no_extension = abap_true "是否多值输入
i_no_intervals = abap_true "是否范围输入
i_value_help_structure = 'ZSFLIGHT_HELP_STRC' "help结构
i_value_help_structure_field = 'CONNID' "help字段
).
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_PLANETYE' ).
"创建select option
wd_this->m_handler->add_selection_field(
i_id = 'S_PLANETYPE' "id
i_description = 'plane type' "描述
it_result = lt_range_table "结果内表
i_no_extension = abap_true "是否多值输入
i_no_intervals = abap_true "是否范围输入
i_value_help_structure = 'ZSFLIGHT_HELP_STRC' "help结构
i_value_help_structure_field = 'PLANETYPE' "help字段
).
选择一个search help可以带出三个域值。
1.7.2问题2:更新selection option标签描述
添加按钮,绑定事件set_text,用来更新selection option描述。使用UPD_SELECTION_FIELD这个方法不能更新selection option描述。
示例代码:
method ONACTIONSET_TEXT .
DATA:lt_range_table type ref to data.
"创建range table
lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'S_CARR_ID' ).
* wd_this->m_handler->REMOVE_SELECTION_SCREEN_ITEM( i_id = 'ID_CARR_ID' ).
* wd_this->m_handler->ADD_SELECTION_FIELD(
* i_id = 'ID_CARR_ID' "id
* i_description = 'tanglujie' "描述
* it_result = lt_range_table "结果内表
* i_obligatory = abap_true "是否必输
* ).
DATA:tt_selection_screen_item TYPE IF_WD_SELECT_OPTIONS=>TT_SELECTION_SCREEN_ITEM.
FIELD-SYMBOLS:<FS_ITEM> like line of tt_selection_screen_item.
wd_this->m_handler->GET_SELECTION_FIELDS( IMPORTING ET_FIELDS = tt_selection_screen_item ).
read table tt_selection_screen_item with key M_ID = 'ID_CARR_ID' assigning <FS_ITEM>.
"先移除
WD_THIS->M_HANDLER->REMOVE_ALL_SEL_SCREEN_ITEMS( ).
<FS_ITEM>-m_description = 'Flight ID'.
WD_THIS->M_HANDLER->ADD_SELECTION_FIELDS( IT_FIELDS = tt_selection_screen_item ).
endmethod.