web dynpro从零开始基础版step_by_step配图
示例:
实现: web dynpro 页面间值传递,web dynpro ALV, web dynpro ALV 标准button控制,web dynpro ALV hotlink,web dynpro ALV可编辑设置,web dynpro 页面跳转
实现代码:
method ONACTIONONSHOW .
DATA lo_nd_data TYPE REF TO if_wd_context_node.
DATA lt_rows type WDR_CONTEXT_ELEMENT_SET.
DATA wa_rows like line of lt_rows.
DATA:L_INDEX TYPE SY-INDEX.
DATA lo_el_data TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA lt_sflight TYPE wd_this->Elements_lt_sflight.
DATA lS_sflight LIKE LINE OF lt_sflight.
lo_nd_data = wd_context->get_child_node( name = wd_this->wdctx_lt_sflight ).
* 获取选中的行
lt_rows = lo_nd_data->GET_SELECTED_ELEMENTS( including_lead_selection = abap_true ).
* 遍历选中的行
* LOOP AT lt_rows INTO wa_rows.
*
* CALL METHOD wa_rows->get_static_attributes
* IMPORTING
* static_attributes = lS_sflight.
* ENDLOOP.
IF lt_rows IS NOT INITIAL.
READ TABLE lt_rows INTO wa_rows INDEX 1.
* 获取选中行数据
CALL METHOD wa_rows->get_static_attributes
IMPORTING
static_attributes = lS_sflight.
* 详情通过子窗口弹出
* 子窗口管理器
* DATA: LO_WINDOW_MANAGER TYPE REF TO IF_WD_WINDOW_MANAGER,
* LO_VIEW_CTRL TYPE REF TO IF_WD_VIEW_CONTROLLER,
* LO_WINDOW TYPE REF TO IF_WD_WINDOW.
*
* LO_VIEW_CTRL = WD_THIS->WD_GET_API( ).
*
* LO_API_COMP = LO_VIEW_CTRL->IF_WD_CONTROLLER~GET_COMPONENT( ).
*
* LO_WINDOW_MANAGER = LO_API_COMP->GET_WINDOW_MANAGER( ).
*
* CALL METHOD LO_WINDOW_MANAGER->CREATE_WINDOW
* EXPORTING
* MODAL = ABAP_TRUE
* WINDOW_NAME = 'W_ASS_HEADERLIST' "子窗口WINDOWS名称
* TITLE = ''
* CLOSE_BUTTON = ABAP_TRUE
* BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_YESNO
* RECEIVING
* WINDOW = LO_WINDOW.
*
* CALL METHOD LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT "单击YES按钮事件
* EXPORTING
* BUTTON = IF_WD_WINDOW=>CO_BUTTON_YES
* ACTION_NAME = 'YES'
* ACTION_VIEW = LO_VIEW_CTRL.
* CALL METHOD LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT
* EXPORTING
* BUTTON = IF_WD_WINDOW=>CO_BUTTON_NO "单击NO按钮事件
* ACTION_NAME = 'NO'
* ACTION_VIEW = LO_VIEW_CTRL.
*
* CALL METHOD LO_WINDOW->SET_WINDOW_SIZE
* EXPORTING
* WIDTH = '800'
* HEIGHT = '400'.
*
* LO_WINDOW->OPEN( ).
ELSE.
* 没有选行,报错
data: l_text type string.
l_text = '你还未选择展示行'.
* get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
l_message_manager = l_current_controller->get_message_manager( ).
* report message
l_message_manager->REPORT_ERROR_MESSAGE(
message_text = l_text
* PARAMS =
* MSG_USER_DATA =
).
ENDIF.
endmethod.
web dynpro从零开始基础版step_by_step配图