zoukankan      html  css  js  c++  java
  • BP搜索帮助,调用BP_HEAD_SEARCH组件

    1.BP类字段,GET V方法:

    METHOD get_v_zhsi0cnn.
      CREATE OBJECT rv_valuehelp_descriptor
        TYPE
        cl_bsp_wd_valuehelp_navdescr
        EXPORTING
          iv_outbound_plug = 'OP_ZHSI0CNN'.
    ENDMETHOD.

    2.外向插件OP_ZHSI0CNN

      METHOD op_zhsi0cnn.
    * Added by wizard: Outbound plug 'ZHSI0CNN'
        bp_account_search( iv_role = 'ZHSI0CNN' ).
      ENDMETHOD.

    3.SEARCH PARAMETER SET & OPEN search certi

    METHOD bp_account_search.
    * only used for account search - Employee and Contact have separate search
    
      DATA : lv_title           TYPE string,
             lv_eventname       TYPE string,
             lr_qs              TYPE REF TO cl_crm_bol_dquery_service,
             lr_current         TYPE REF TO cl_crm_bol_entity,
             lr_col             TYPE REF TO if_bol_bo_col,
             lr_context         TYPE REF TO cl_bsp_wd_context_node,
             lv_empresp         TYPE string,
             lv_collection      TYPE REF TO if_bol_bo_col,
             lr_btpartnerset    TYPE REF TO cl_crm_bol_entity,
             lr_btpartner       TYPE REF TO cl_crm_bol_entity,
             lr_partnerset_ctxt TYPE REF TO cl_crm_uiu_btpartnerset_cn.
      DATA:   lv_low TYPE string.
      DATA:   ls_selection TYPE        genilt_selection_parameter,
              lr_valuenode TYPE REF TO cl_bsp_wd_value_node,
              lr_ref_any   TYPE REF TO data.
    
      FIELD-SYMBOLS: <lv_context_node>            TYPE any,
                     <lv_partnerset_context_node> TYPE any.
      DATA:    lr_param    TYPE REF TO if_bol_bo_property_access,
               lr_iterator TYPE REF TO if_bol_bo_col_iterator,
               lt_params   TYPE  genilt_selection_parameter_tab.
      DATA:    ls_general          TYPE  zcorder_general.
    
      DATA lv_sales_org TYPE crmt_sales_org.
      DATA lv_land TYPE land1."当前账号所属国家
      CALL FUNCTION 'Z_GET_SALESORG_BY_USER'
        EXPORTING
          iv_user    = sy-uname
        IMPORTING
          ev_country = lv_land.
    
      lr_current ?= me->typed_context->zcorder->collection_wrapper->get_current( ).
      lr_current->get_properties( IMPORTING es_attributes = ls_general ).
    
      CASE iv_role.
        WHEN 'SOLDTO'.
          lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PARTNER_SEARCH' ).
          IF bpsearch_account_popup IS NOT BOUND.
            bpsearch_account_popup = comp_controller->window_manager->create_popup(
                iv_interface_view_name = 'SearchHelpWindow'     "#EC NOTEXT
                iv_usage_name = 'CUBPSearchAccount'
                iv_title = lv_title ).
          ENDIF.
    
    * set display mode
          bpsearch_account_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
    * Open the Popup
          bpsearch_account_popup->open( iv_inbound_plug = 'CLEAR_ALL' ).
    
    * Role dependand Event
          CONCATENATE 'SEL' iv_role INTO lv_eventname.
          bpsearch_account_popup->set_on_close_event( iv_view = me iv_event_name = lv_eventname ).
    *     Get Query Context node
          lr_context = bpsearch_account_popup->get_context_node( 'SEARCH' ).
          CHECK lr_context IS BOUND.
    *     Get DQuery object to add search parameter
          lr_qs ?= lr_context->collection_wrapper->get_current( ).
          CHECK lr_qs IS BOUND.
          lr_col = lr_qs->get_selection_params( ).
          IF iv_role = 'SERPR' OR iv_role = 'RELAIER' OR iv_role = 'SOLDTO'.
            CASE iv_role.
              WHEN 'SERPR'.
                lv_low = 'Z003'.
                ls_selection-attr_name = 'ZBP_GROUP'.
                ls_selection-sign = 'I'.
                ls_selection-option = 'EQ'.
                ls_selection-low  = lv_low .
                GET REFERENCE OF ls_selection  INTO lr_ref_any.
                CREATE OBJECT lr_valuenode
                  TYPE
                  cl_bsp_wd_value_node
                  EXPORTING
                    iv_data_ref = lr_ref_any.
                lr_col->add( lr_valuenode ).
              WHEN 'RELAIER'.
                lv_low = 'Z005'.
                ls_selection-attr_name = 'ZBP_GROUP'.
                ls_selection-sign = 'I'.
                ls_selection-option = 'EQ'.
                ls_selection-low  = lv_low .
                GET REFERENCE OF ls_selection  INTO lr_ref_any.
                CREATE OBJECT lr_valuenode
                  TYPE
                  cl_bsp_wd_value_node
                  EXPORTING
                    iv_data_ref = lr_ref_any.
                lr_col->add( lr_valuenode ).
              WHEN 'SOLDTO'.
                IF sy-langu = 'J'."ADD BY LY 20170328
                  lr_qs->add_selection_param( iv_attr_name = 'COUNTRY'
                                    iv_sign      = 'I'
                                    iv_option    =  'EQ'
                                    iv_low       = 'JP' ).
                ENDIF.
    
            ENDCASE.
          ENDIF.
    
    
          bpsearch_account_popup->open( iv_inbound_plug = 'CLEAR_ALL'
                                         iv_collection =    lr_col ).
        WHEN 'SERPR'.
    
          lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PARTNER_SEARCH' ).
          IF bpsearch_account_popup1 IS NOT BOUND.
            bpsearch_account_popup1 = comp_controller->window_manager->create_popup(
                iv_interface_view_name = 'SearchHelpWindow'     "#EC NOTEXT
                iv_usage_name = 'CUBPSearchAccount'
                iv_title = lv_title ).
          ENDIF.
    
    * set display mode
          bpsearch_account_popup1->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
    * Open the Popup
          bpsearch_account_popup1->open( iv_inbound_plug = 'CLEAR_ALL' ).
    
    * Role dependand Event
          CONCATENATE 'SEL' iv_role INTO lv_eventname.
          bpsearch_account_popup1->set_on_close_event( iv_view = me iv_event_name = lv_eventname ).
    *     Get Query Context node
          lr_context = bpsearch_account_popup1->get_context_node( 'SEARCH' ).
          CHECK lr_context IS BOUND.
    *     Get DQuery object to add search parameter
          lr_qs ?= lr_context->collection_wrapper->get_current( ).
          CHECK lr_qs IS BOUND.
          lr_current ?= me->typed_context->zcorder->collection_wrapper->get_current( ).
          lr_current->get_properties( IMPORTING es_attributes = ls_general ).
          lv_low = ls_general-sales_org.
          lr_qs->add_selection_param( iv_attr_name = 'ZSALES_ORG'
                                     iv_sign      = 'I'
                                     iv_option    =  'EQ'
                                     iv_low       =   lv_low ).
    
          lr_qs->add_selection_param( iv_attr_name = 'ZBP_GROUP'
                                      iv_sign      = 'I'
                                      iv_option    =  'EQ'
                                      iv_low       = 'Z003' ).
          lr_col = lr_qs->get_selection_params( ).
          lr_iterator   = lr_col->get_iterator( ).
          lr_param      = lr_iterator->get_first( ).
          WHILE lr_param IS BOUND.
            lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
            IF ls_selection-attr_name = 'ZBP_GROUP' AND ls_selection-low IS INITIAL.
              lr_col->remove( lr_param ).
              EXIT.
            ENDIF.
            lr_param = lr_iterator->get_next( ).
          ENDWHILE.
          lr_param      = lr_iterator->get_first( ).
          WHILE lr_param IS BOUND.
            lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
            IF ls_selection-attr_name = 'ZSALES_ORG' AND ls_selection-low IS INITIAL.
              lr_col->remove( lr_param ).
              EXIT.
            ENDIF.
            lr_param = lr_iterator->get_next( ).
          ENDWHILE.
          bpsearch_account_popup1->open( iv_inbound_plug = 'CLEAR_ALL'
                                         iv_collection =    lr_col ).
        WHEN 'RELAIER' OR 'CONSIGNOR'.
          lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PARTNER_SEARCH' ).
          IF bpsearch_account_popup2 IS NOT BOUND.
            bpsearch_account_popup2 = comp_controller->window_manager->create_popup(
                iv_interface_view_name = 'SearchHelpWindow'     "#EC NOTEXT
                iv_usage_name = 'CUBPSearchAccount'
                iv_title = lv_title ).
          ENDIF.
    
    * set display mode
          bpsearch_account_popup2->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
    * Open the Popup
          bpsearch_account_popup2->open( iv_inbound_plug = 'CLEAR_ALL' ).
    * Role dependand Event
          CONCATENATE 'SEL' iv_role INTO lv_eventname.
          bpsearch_account_popup2->set_on_close_event( iv_view = me iv_event_name = lv_eventname ).
    *     Get Query Context node
          lr_context = bpsearch_account_popup2->get_context_node( 'SEARCH' ).
          CHECK lr_context IS BOUND.
    *     Get DQuery object to add search parameter
          lr_qs ?= lr_context->collection_wrapper->get_current( ).
          CHECK lr_qs IS BOUND.
    
    *********add by dq-yuw 南非retailer 分组为z006
          IF lv_land EQ 'ZA' OR ls_general-country EQ 'ZA'..
    
            lr_qs->add_selection_param( iv_attr_name = 'PARTNER'
                                        iv_sign      = 'I'
                                        iv_option    =  'SW'
                                        iv_low       = '5' ).
          ELSE.
            lr_qs->add_selection_param( iv_attr_name = 'ZBP_GROUP'
                                      iv_sign      = 'I'
                                      iv_option    =  'EQ'
                                      iv_low       = 'Z005' ).
            IF iv_role = 'CONSIGNOR'.
              lr_qs->add_selection_param( iv_attr_name = 'ZBP_GROUP'
                              iv_sign      = 'I'
                              iv_option    =  'EQ'
                              iv_low       = 'Z006' ).
            ENDIF.
          ENDIF.
    ****************end add
          IF sy-langu = 'J'."ADD BY LY 20170328
            lr_qs->add_selection_param( iv_attr_name = 'COUNTRY'
                              iv_sign      = 'I'
                              iv_option    =  'EQ'
                              iv_low       = 'JP' ).
          ENDIF.
    
          lr_current ?= me->typed_context->zcorder->collection_wrapper->get_current( ).
          lr_current->get_properties( IMPORTING es_attributes = ls_general ).
          lv_low = ls_general-sales_org.
          lr_qs->add_selection_param( iv_attr_name = 'ZSALES_ORG'
                                     iv_sign      = 'I'
                                     iv_option    =  'EQ'
                                     iv_low       =   lv_low ).
          lr_col = lr_qs->get_selection_params( ).
          lr_iterator   = lr_col->get_iterator( ).
          lr_param      = lr_iterator->get_first( ).
          WHILE lr_param IS BOUND.
            lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
            IF ls_selection-attr_name = 'ZBP_GROUP' AND ls_selection-low IS INITIAL.
              lr_col->remove( lr_param ).
              EXIT.
            ENDIF.
            lr_param = lr_iterator->get_next( ).
          ENDWHILE.
          lr_param      = lr_iterator->get_first( ).
          WHILE lr_param IS BOUND.
            lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
            IF ls_selection-attr_name = 'ZSALES_ORG' AND ls_selection-low IS INITIAL.
              lr_col->remove( lr_param ).
              EXIT.
            ENDIF.
            lr_param = lr_iterator->get_next( ).
          ENDWHILE.
          WHILE lr_param IS BOUND.
            lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
            IF ls_selection-attr_name = 'COUNTRY' AND ls_selection-low IS INITIAL.
              lr_col->remove( lr_param ).
    *          EXIT.
            ENDIF.
            lr_param = lr_iterator->get_next( ).
          ENDWHILE.
          bpsearch_account_popup2->open( iv_inbound_plug = 'CLEAR_ALL'
                                         iv_collection =    lr_col ).
    
        WHEN 'NETWORK' OR 'ZHSI0CNN'.
          lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PARTNER_SEARCH' ).
          IF bpsearch_account_popup2 IS NOT BOUND.
            bpsearch_account_popup2 = comp_controller->window_manager->create_popup(
                iv_interface_view_name = 'SearchHelpWindow'     "#EC NOTEXT
                iv_usage_name = 'CUBPSearchAccount'
                iv_title = lv_title ).
          ENDIF.
    
    * set display mode
          bpsearch_account_popup2->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
    * Open the Popup
          bpsearch_account_popup2->open( iv_inbound_plug = 'CLEAR_ALL' ).
    * Role dependand Event
          CONCATENATE 'SEL' iv_role INTO lv_eventname.
          bpsearch_account_popup2->set_on_close_event( iv_view = me iv_event_name = lv_eventname ).
    *     Get Query Context node
          lr_context = bpsearch_account_popup2->get_context_node( 'SEARCH' ).
          CHECK lr_context IS BOUND.
    *     Get DQuery object to add search parameter
          lr_qs ?= lr_context->collection_wrapper->get_current( ).
          CHECK lr_qs IS BOUND.
          IF sy-langu = 'J'."ADD BY LY 20170328
                  lr_qs->add_selection_param( iv_attr_name = 'COUNTRY'
                                    iv_sign      = 'I'
                                    iv_option    =  'EQ'
                                    iv_low       = 'JP' ).
                ENDIF.
    
          lr_qs->add_selection_param( iv_attr_name = 'ZBP_GROUP'
                                      iv_sign      = 'I'
                                      iv_option    =  'EQ'
                                      iv_low       = 'Z010' ).
    
          lr_col = lr_qs->get_selection_params( ).
          lr_iterator   = lr_col->get_iterator( ).
          lr_param      = lr_iterator->get_first( ).
          WHILE lr_param IS BOUND.
            lr_param->get_properties( IMPORTING es_attributes = ls_selection ).
            IF ls_selection-attr_name = 'ZBP_GROUP' AND ls_selection-low IS INITIAL.
              lr_col->remove( lr_param ).
              EXIT.
            ENDIF.
            lr_param = lr_iterator->get_next( ).
          ENDWHILE.
    
          bpsearch_account_popup2->open( iv_inbound_plug = 'CLEAR_ALL'
                                         iv_collection =    lr_col ).
        WHEN 'LOGICAL'.
          lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PARTNER_SEARCH' ).
          IF bpsearch_account_popup IS NOT BOUND.
            bpsearch_account_popup = comp_controller->window_manager->create_popup(
                iv_interface_view_name = 'SearchHelpWindow'     "#EC NOTEXT
                iv_usage_name = 'CUBPSearchAccount'
                iv_title = lv_title ).
          ENDIF.
    
    * set display mode
          bpsearch_account_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).
    * Open the Popup
          bpsearch_account_popup->open( iv_inbound_plug = 'CLEAR_ALL' ).
    * Role dependand Event
          CONCATENATE 'SEL' iv_role INTO lv_eventname.
          bpsearch_account_popup->set_on_close_event( iv_view = me iv_event_name = lv_eventname ).
    *     Get Query Context node
          lr_context = bpsearch_account_popup->get_context_node( 'SEARCH' ).
          CHECK lr_context IS BOUND.
    *     Get DQuery object to add search parameter
          lr_qs ?= lr_context->collection_wrapper->get_current( ).
          CHECK lr_qs IS BOUND.
    
          lr_qs->add_selection_param( iv_attr_name = 'ZBP_GROUP'
                                      iv_sign      = 'I'
                                      iv_option    =  'EQ'
                                      iv_low       = 'Z003' ).
          lr_current ?= me->typed_context->zcorder->collection_wrapper->get_current( ).
          lr_current->get_properties( IMPORTING es_attributes = ls_general ).
          lv_low = ls_general-sales_org.
          IF lv_low IS NOT INITIAL.
            lr_qs->add_selection_param( iv_attr_name = 'ZSALES_ORG'
                                       iv_sign      = 'I'
                                       iv_option    =  'EQ'
                                       iv_low       =   lv_low ).
          ENDIF.
    
          lv_low = ls_general-country.
          IF lv_low IS NOT INITIAL.
            lr_qs->add_selection_param( iv_attr_name = 'COUNTRY'
                                       iv_sign      = 'I'
                                       iv_option    =  'EQ'
                                       iv_low       =   lv_low ).
          ENDIF.
          bpsearch_account_popup->open( iv_inbound_plug = 'CLEAR_ALL'
                                         iv_collection =    lr_col ).
      ENDCASE.
    
    
    
    ENDMETHOD.

     4.ComponentUsages导入

  • 相关阅读:
    POJ 3261 Milk Patterns (求可重叠的k次最长重复子串)
    UVaLive 5031 Graph and Queries (Treap)
    Uva 11996 Jewel Magic (Splay)
    HYSBZ
    POJ 3580 SuperMemo (Splay 区间更新、翻转、循环右移,插入,删除,查询)
    HDU 1890 Robotic Sort (Splay 区间翻转)
    【转】ACM中java的使用
    HDU 4267 A Simple Problem with Integers (树状数组)
    POJ 1195 Mobile phones (二维树状数组)
    HDU 4417 Super Mario (树状数组/线段树)
  • 原文地址:https://www.cnblogs.com/sapSB/p/6635171.html
Copyright © 2011-2022 走看看