Web Dynpro for ABAP(15):Print

3.20 Print

WDA调用浏览器打印界面

1.创建Print按钮,绑定事件PRINT;

2.实现ONACTIONPRINT事件;

method ONACTIONPRINT.
  DATA:l_api_componentcontroller TYPE REF TO if_wd_component.
  DATA:l_appl TYPE REF TO if_wd_application.
  l_api_componentcontroller = wd_comp_controller->wd_get_api( ).
  l_appl = l_api_componentcontroller->get_application( ).
  l_appl->print_page( ).
endmethod. 

3.在WDDOINIT事件中注册Action,好像不用?

"注册Print事件
  DATA:lo_api_controller TYPE REF TO if_wd_view_controller.
  DATA:lo_action TYPE REF TO if_wd_action.
  lo_api_controller = wd_this->wd_get_api( ).
  lo_action = lo_api_controller->get_action( name = 'PRINT' ).
  IF lo_action IS BOUND.
    lo_action->set( keep_messages = abap_true ).
  ENDIF.
posted @ 2022-06-11 11:22  渔歌晚唱  阅读(71)  评论(0编辑  收藏  举报