I created custom UI component based on RAD (Rapid Application Framework), and i wanted to navigate from it to standard component BP_HEAD (BP partner overview page). I tried to use dynamic navigation. In line when i'am trying to get root entity, program generates error with message that 'BuilHeader' is an object that is not accessible. What I'am doing wrong? Do my approach to the problem is correct? Following code was included to event method triggered by click on hyperlink in result list:
DATA: lr_nav_descr TYPE REF TO if_bol_bo_property_access,
lr_core TYPE REF TO cl_crm_bol_core,
lr_nav_serv TYPE REF TO if_crm_ui_navigation_service,
lr_header TYPE REF TO cl_crm_bol_entity,
lr_entity TYPE REF TO cl_crm_bol_entity,"cl_bsp_wd_value_node,
lv_partner_guid TYPE crmt_genil_object_guid,
lr_col TYPE REF TO cl_crm_bol_bo_col.
DATA: lv_partner TYPE bu_partner,
lv_index TYPE sytabix,
lv_guid TYPE crmt_genil_object_guid.
* Let's get current row info
CALL METHOD cl_thtmlb_util=>get_event_info
EXPORTING
iv_event = htmlb_event_ex
IMPORTING
ev_index = lv_index.
* Get entity for the current row
CLEAR: lv_guid.
lr_entity ?= typed_context->searchresultnode->collection_wrapper->find( iv_index = lv_index ).
IF lr_entity IS BOUND.
lv_partner = lr_entity->get_property_as_string( iv_attr_name = 'ZZPARTNER' ).
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_partner
IMPORTING
output = lv_partner.
SELECT SINGLE partner_guid FROM but000 INTO lv_partner_guid WHERE partner = lv_partner.
* Get the BOL Core Instance
lr_core ?= cl_crm_bol_core=>get_instance( ).
* get the BuilHeader object
lr_header = lr_core->get_root_entity( iv_object_name = 'BuilHeader'
iv_object_guid = lv_partner_guid ).
* add the Builheader to the collection
CREATE OBJECT lr_col.
lr_col->if_bol_bo_col~add( iv_entity = lr_header
iv_set_focus = abap_true ).
cl_crm_ui_descriptor_obj_srv=>create_ui_object_based(
EXPORTING
iv_ui_object_type = 'BP_ACCOUNT'
iv_ui_object_action = 'B'
RECEIVING rr_result = lr_nav_descr ).
lr_nav_serv = cl_crm_ui_navigation_service=>get_instance( ).
* check if navigation is possible
IF lr_nav_serv->is_dynamic_nav_supported( ir_descriptor_object = lr_nav_descr ) = abap_true.
lr_col->if_bol_bo_col~insert( iv_bo = lr_nav_descr
iv_index = 1 ).
* start the navigation
lr_nav_serv->navigate_dynamically( iv_data_collection = lr_col ).
ENDIF.