其实质是 在web dynpro中触发一个事件,然后在R3中去捕捉那个事件。
然后执行相应的操作。
捕捉事件使用继承自cl——gui——wdr——ciewer的类
然后使用此类去call web dynpro 并注册事件
=====================in web dynpro=======================================
DATA l_componentcontroller TYPE REF TO ig_componentcontroller .
DATA l_api_componentcontroller TYPE REF TO if_wd_component.
DATA l_sapgui_manager TYPE REF TO cl_wdr_sapgui_integration.
l_componentcontroller = wd_this->get_componentcontroller_ctr( ).
l_api_componentcontroller = l_componentcontroller->wd_get_api( ).
l_sapgui_manager = l_api_componentcontroller->get_sapgui_manager( ).
IF l_sapgui_manager IS NOT INITIAL.
l_sapgui_manager->fire(
EXPORTING
name = 'SELECT_PHASE'
param1 = l_phase ).
ENDIF.
======================in R3 dialog=======================
*----------------------------------------------------------------------*
* CLASS cl_my_gui_wdr_viewer DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_my_gui_wdr_viewer DEFINITION INHERITING FROM cl_gui_wdr_viewer.
PUBLIC SECTION.
METHODS: on_wd_event FOR EVENT wd_event OF cl_gui_wdr_viewer
IMPORTING action parameters.
ENDCLASS. "cl_my_gui_wdr_viewer DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_my_gui_wdr_viewer IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_my_gui_wdr_viewer IMPLEMENTATION.
METHOD on_wd_event.
FIELD-SYMBOLS: <fs_parameter> TYPE wdr_name_value.
DATA l_num type n.
IF action = 'SELECT_PHASE'.
READ TABLE parameters ASSIGNING <fs_parameter> INDEX 1.
TRY.
l_num = <fs_parameter>-value.
CATCH cx_root.
MESSAGE e088(st) WITH text-001.
ENDTRY.
if l_num lt 1 or l_num gt 3.
MESSAGE e088(st) WITH text-001.
endif.
phase = <fs_parameter>-value.
ENDIF.
ENDMETHOD. "on_wd_event
ENDCLASS. "cl_my_gui_wdr_viewer IMPLEMENTATION