Web Dynpro 如何生成弹窗

1. 弹出窗口为Webdynpro窗口
在Webdynpro Component里建好一个窗口,取名 W_POPUP
在要生成弹窗的事件中写以下代码:

DATA lo_nd_error_message TYPE REF TO if_wd_context_node.
DATA lo_el_error_message TYPE REF TO if_wd_context_element.
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.

lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window(
window_name = 'W_POPUP'
title = 'POPUP WINDOW'
message_display_mode = if_wd_window=>co_msg_display_mode_selected
close_button = abap_true
button_kind = if_wd_window=>co_buttons_close
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_close
).
lo_window->open( ).

2. 弹出窗口为外部窗口,即链接到外部URL
在要生成弹窗的事件中写以下代码:

data: window_manager type ref to if_wd_window_manager,
api_component type ref to if_wd_component,
lo_window type ref to if_wd_window.

api_component = wd_comp_controller->wd_get_api( ).
window_manager = api_component->get_window_manager( ).

CALL METHOD window_manager->create_external_window
EXPORTING
url = lv_ext_url "要链接到的URL地址
title = 'POP WINDOW'
modal = abap_true
has_menubar = abap_false
is_resizable = abap_true
has_scrollbars = abap_false
has_statusbar = abap_false
has_toolbar = abap_false
has_location = abap_false
RECEIVING
window = lo_window.

lo_window->open( ).

Leave a Reply

Your email address will not be published.