webdynpro的select_option樣本

來源:互聯網
上載者:User

標籤:des   style   blog   http   java   color   

需求,輸入航線代碼和航線編號區間,查詢記錄存在表中顯示,並不是alv顯示

1、使用組件WDR_SELECT_OPTIONS.

2.在組件控制器中加入以下組件

3、在視圖屬性中也添加該組件

4、建立節點

5、控制項設計

6、視窗下的視圖中嵌套這個視圖

7、設計檢視初始化方法WDDOINIT

method WDDOINIT .DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.  lo_cmp_usage = wd_this->wd_cpuse_select_options( ).  IF lo_cmp_usage->has_active_component( ) IS INITIAL.    lo_cmp_usage->create_component( ).  ELSE.    EXIT.  ENDIF.*---選擇螢幕的引用  DATA lo_interfacecontroller TYPE REF TO iwci_wdr_select_options .  lo_interfacecontroller =   wd_this->wd_cpifc_select_options( ).  "修改SELECT_OPTIONS  wd_this->m_handler = lo_interfacecontroller->init_selection_screen(   ).*---設定全域資訊  CALL METHOD wd_this->m_handler->set_global_options    EXPORTING      i_display_btn_cancel  = abap_false      i_display_btn_check   = abap_false      i_display_btn_reset   = abap_false      i_display_btn_execute = abap_false.  DATA: lr_field TYPE REF TO data.  DEFINE mcr_sel.    free lr_field.    lr_field = wd_this->m_handler->create_range_table( &1 ).    wd_this->m_handler->add_selection_field(      i_id = &1                                "欄位參考類型      i_description = &2                       "描述      it_result = lr_field      i_read_only = &3 ).  END-OF-DEFINITION.  mcr_sel ‘S_CARR_ID‘ ‘航線代碼‘ abap_false.  mcr_sel ‘S_CONN_ID‘ ‘航班編號‘ abap_false.endmethod.

8、設計按鈕SEARCH事件方法

method ONACTIONSEARCH .*擷取SELECT OPTIONS  FIELD-SYMBOLS: <fs_CARRID> TYPE ANY TABLE,                 <fs_CONNID> TYPE ANY TABLE.  DATA lv_CARRID TYPE S_CARR_ID .          "螢幕上輸入的  DATA lv_CONNID TYPE S_CONN_ID .          "螢幕上輸入的  DATA:lo_data TYPE REF TO data.  FREE lo_data.  lo_data = wd_this->m_handler->get_range_table_of_sel_field( ‘S_CARR_ID‘ ).  ASSIGN lo_data->* TO <fs_CARRID>.  FREE lo_data.  lo_data = wd_this->m_handler->get_range_table_of_sel_field( ‘S_CONN_ID‘ ).  ASSIGN lo_data->* TO <fs_CONNID>.*資料繫結  DATA lo_nd_sflight TYPE REF TO if_wd_context_node.  DATA lo_el_sflight TYPE REF TO if_wd_context_element.  DATA lt_sflight TYPE wd_this->Elements_sflight.  lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).  SELECT * INTO TABLE lt_sflight from sflight    WHERE CARRID in <fs_CARRID>    AND   CONNID in <fs_CONNID>.  lo_nd_sflight->BIND_TABLE(  NEW_ITEMS = lt_sflight ).endmethod.

9、效果展示

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.