Skip to Content

效果:在增强字段中借用系统标准的组件进行搜索帮助,如下图所示:

QQ20150824-1@2x.png

通过直接调用目标组件(报表),实现目标字段直接填充到自己的增强字段中。

具体实现步骤:

1.     在对应视图 增强字段ZZRCMS的get_v方法GET_V_ZZRCMS中放入如下代码:

method GET_V_ZZRCMS.

   CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_navdescr
                 EXPORTING iv_outbound_plug = ‘OP_SEARCHZZRCMS’.

endmethod.

2. 在实施类ZL_BT126H_A_APPTDETAILS_IMPL中添加属性GV_INDEX和ZZRCMSVALUEHELP_POPUP。其中GV_INDEX参照CRMT_IDX,ZZRCMSVALUEHELP_POPUP参照IF_BSP_WD_POPUP。如下图所示:

QQ20150824-2@2x.png


同时新建外向插件方法OP_SEARCHZZRCMS(注意:此处一定要通过在实施类中直接创建PUBLIC的外向插件方法,而不是在视图的外向插件中右键创建)。如下图所示:


QQ20150824-3@2x.png


双击该方法写入如下代码:

  METHOD op_searchzzrcms.

     DATA:
       lv_title                TYPE string,
       lv_attribute        TYPE string,
       lv_model           TYPE string,
       lv_event_string TYPE string.

     cl_chtmlb_config_utility=>outbound_plug_event_info(
     EXPORTING
       iv_event_string = lv_event_string
     IMPORTING
       ev_model_name   = lv_model
       ev_index      = gv_index
       ev_attribute    = lv_attribute ).

     lv_title = ‘TEST’.
     IF zzrcmsvaluehelp_popup IS NOT BOUND.

       zzrcmsvaluehelp_popup = comp_controller->window_manager->create_popup(
       iv_interface_view_name = ‘MainWindow’
       iv_usage_name = ‘CUIZZRCMSValueHelp’    
       iv_title = lv_title ).
     ENDIF.

     zzrcmsvaluehelp_popup->set_on_close_event( iv_view = me iv_event_name = ‘SEL_ZZRCMS’ ).
     zzrcmsvaluehelp_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
     zzrcmsvaluehelp_popup->open( ).

   ENDMETHOD.

3.  代码中,CUIZZRCMSValueHelp 为component usage的名称,建立component usage的方法如下:

     在增强字段所在的组件中,进入“运行时资源库编辑器”,点击编辑按钮,然后创建USAGE,如下图所示:

QQ20150824-4@2x.png

输入如下信息后回车,并保存

QQ20150824-5@2x.png

保存以后可以看到如下信息:

QQ20150824-6@2x.png

4. 在外向插件方法中还可以看到SEL_ZZRCMS方法。在事件处理器中右键新建方法SEL_ZZRCMS,然后写入如下代码:

  METHOD eh_onsel_zzrcms.
* Added by wizard: Handler for event ‘SEL_ZZRCMS’
     DATA: lv_col_wrapper   TYPE REF TO cl_bsp_wd_collection_wrapper,
           lv_current       TYPE REF TO if_bol_bo_property_access,
           lv_icmp          TYPE REF TO data,
           lv_id_icmp       TYPE REF TO if_bol_bo_property_access,
           lv_outbound_plug TYPE seocmpname,
           lv_context_node  TYPE REF TO cl_bsp_wd_context_node.

     FIELD-SYMBOLS: <lv_ib_icmp> TYPE any.

     lv_context_node = zzrcmsvaluehelp_popup->get_context_node( iv_cnode_name = ‘BTQRACT’ ).          “BTQRACT为目标组件的节点名称
     lv_col_wrapper = lv_context_node->collection_wrapper.
     lv_current ?= lv_col_wrapper->get_current( ).

     IF lv_current IS BOUND.

       lv_outbound_plug = zzrcmsvaluehelp_popup->get_fired_outbound_plug( ).
*      CHECK lv_outbound_plug = ‘TOOVERVIEW’.           “#EC NOTEXT
       lv_icmp ?= lv_current->get_property( iv_attr_name = ‘DESCRIPTION’ ).                                                  “DESCRIPTION是要获取的目标组件属性
       ASSIGN lv_icmp->* TO <lv_ib_icmp>.
       lv_id_icmp ?= me->typed_context->btadminh->collection_wrapper->find( iv_index = gv_index ).             “btadminh是当前节点的名称
       lv_id_icmp->set_property( iv_attr_name = ‘ZZRCMS’ iv_value = <lv_ib_icmp> ).
     ENDIF.

     CLEAR gv_index.
   ENDMETHOD.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply