动态BT跳转

时间:2020-12-14 07:19:41
  METHOD eh_onzobject_id_link.
***定义
DATA :
lv_crmt_object_guid TYPE crmt_object_guid,
lv_index TYPE i,
lr_property_access TYPE REF TO if_bol_bo_property_access,
lv_object_id TYPE crmt_object_id_db.
***获取对象
*==获取选中行INDEX
cl_thtmlb_util=>get_event_info( EXPORTING iv_event = htmlb_event_ex IMPORTING ev_index = lv_index ).
CHECK lv_index IS NOT INITIAL .
*==获取选中行context
lr_property_access ?= me->typed_context->searchresultnode->collection_wrapper->find( iv_index = lv_index ).
CHECK lr_property_access IS BOUND .
*==生成订单BOL
CLEAR :lv_crmt_object_guid .
lv_crmt_object_guid = lr_property_access->get_property_as_string( iv_attr_name = 'OBJECT_GUID' ).
CHECK lv_crmt_object_guid IS NOT INITIAL .
CALL FUNCTION 'ZCRM_NAVIGATE_BT'
EXPORTING
iv_guid = lv_crmt_object_guid.
ENDMETHOD.
FUNCTION zcrm_navigate_bt.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_GUID) TYPE CRMT_OBJECT_GUID OPTIONAL
*"---------------------------------------------------------------------- gr_bol_core = cl_crm_bol_core=>get_instance( ).
gr_bol_core->load_component_set('ONEORDER' ).
TRY.
CALL METHOD gr_bol_core->get_root_entity
EXPORTING
iv_object_name = 'BTOrder' "#EC NOTEXT BTOrder
iv_object_guid = iv_guid
RECEIVING
rv_result = gr_btorder.
CATCH cx_crm_genil_model_error .
RETURN .
ENDTRY .
***对象跳转
*==导航组件
gv_bsp_dlc_object_type = cl_crm_uiu_ibase_tool=>get_bt_ui_object_type( gr_btorder )."设计对象类型
CALL METHOD cl_crm_ui_descriptor_obj_srv=>create_entity_based
EXPORTING
ir_entity = gr_btorder
iv_ui_object_type = gv_bsp_dlc_object_type
iv_ui_object_action = 'B'
RECEIVING
rr_result = gr_if_bol_bo_property_access. *==动态导航collection
CREATE OBJECT gr_if_bol_bo_col TYPE cl_crm_bol_bo_col .
gr_if_bol_bo_col->add( iv_entity = gr_btorder iv_set_focus = abap_true ).
gr_if_bol_bo_col->insert( iv_bo = gr_if_bol_bo_property_access iv_index = ).
*==动态导航
gr_crm_ui_navigation_service = cl_crm_ui_navigation_service=>get_instance( ).
IF gr_crm_ui_navigation_service IS BOUND .
gr_crm_ui_navigation_service->navigate_dynamically( gr_if_bol_bo_col ).
ENDIF . ENDFUNCTION.

2.

  METHOD eh_ontosrvord.
* Added by wizard: Handler for event 'TOSRVORD' DATA: lv_index TYPE int4,
* lr_comp_controller TYPE REF TO cl_bt111s_o_bspwdcomponen_impl,
* lr_cuco TYPE REF TO cl_bt111s_o_cucosearch_impl,
lr_entity TYPE REF TO if_bol_bo_property_access,
lv_event TYPE REF TO cl_htmlb_event_tableview,
lr_msg_srv TYPE REF TO cl_bsp_wd_message_service,
lv_subrc TYPE sy-subrc,
lv_tableview_ex TYPE REF TO cl_thtmlb_table_view. * CALL METHOD cl_thtmlb_util=>get_event_info
* EXPORTING
* iv_event = htmlb_event_ex
* IMPORTING
* ev_index = lv_index. * set entity as current one
lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ). CHECK lr_entity IS BOUND. DATA l_guid TYPE crmd_orderadm_h-guid.
DATA l_srv_no TYPE crmd_orderadm_h-object_id.
CALL METHOD lr_entity->get_property_as_string
EXPORTING
iv_attr_name = 'OBJECT_ID'
* iv_use_iso_format = ABAP_FALSE
RECEIVING
rv_result = l_srv_no. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_srv_no
IMPORTING
OUTPUT = l_srv_no. DATA: wa_zsrv_order_relat TYPE zsrv_order_relat.
SELECT SINGLE *
FROM zsrv_order_relat
INTO wa_zsrv_order_relat
WHERE zsrv_order = l_srv_no. select SINGLE guid
FROM crmd_orderadm_h
INTO l_guid
WHERE object_id = wa_zsrv_order_relat-ZWORK_ORDER
AND process_type LIKE 'ZW%'. DATA lr_core TYPE REF TO cl_crm_bol_core.
DATA lr_bt TYPE REF TO cl_crm_bol_entity.
lr_core = cl_crm_bol_core=>get_instance( ).
*初始化 BT为组件集名称
lr_core->start_up( 'BT' ). TRY.
CALL METHOD lr_core->get_root_entity
EXPORTING
iv_object_name = 'BTOrder'
iv_object_guid = l_guid " 单句对应的GUID
RECEIVING
rv_result = lr_bt.
CATCH cx_crm_genil_model_error .
ENDTRY. CHECK lr_bt IS BOUND. RAISE EVENT history_trigger. DATA: lr_nav_descr TYPE REF TO if_bol_bo_property_access.
DATA: lr_navigation TYPE REF TO if_crm_ui_navigation_service.
DATA: lr_col TYPE REF TO cl_crm_bol_bo_col.
DATA: rv_value_node TYPE REF TO cl_bsp_wd_value_node. cl_crm_ui_descriptor_obj_srv=>create_ui_object_based(
EXPORTING iv_ui_object_type = 'BT116_SRVO'
iv_ui_object_action = 'B'
RECEIVING rr_result = lr_nav_descr ). CHECK lr_nav_descr IS BOUND.
lr_navigation = cl_crm_ui_navigation_service=>get_instance( me ).
CHECK lr_navigation IS BOUND. * Check whether navigation is supported
IF lr_navigation->is_dynamic_nav_supported( lr_nav_descr ) NE abap_true.
RETURN.
ELSE.
CREATE OBJECT lr_col.
lr_col->if_bol_bo_col~add( iv_entity = lr_nav_descr ).
lr_col->if_bol_bo_col~add( iv_entity = lr_bt iv_set_focus = abap_true ).
lr_navigation->navigate_dynamically( lr_col ).
ENDIF. ENDMETHOD.