WEB UI Navigation to BOL Entity

This is a couple of sample code blocks to demonstrate how to navigate to an entity in SAP CRM Web UI.

Let’s assume that we need to navigate to an order from our BSP application.

Frist we need to create the order entity that we want to navigate to. For that, we need the GUID of the order. Let’s say have the guid in a local variable named by lv_guid

  DATA: lr_core           TYPE REF TO cl_crm_bol_core,
        lr_order          TYPE REF TO cl_crm_bol_entity,
        lv_guid           TYPE crmt_object_guid.

  lr_core    = cl_crm_bol_core=>get_instance( ).
  lr_order   = lr_core->get_root_entity( iv_object_name = 'BTOrder'
                                         iv_object_guid = lv_guid  ).

  CHECK lr_order IS BOUND.

 

Now we have our order entity lr_order. We need three variables for the navigation,

  • A descriptor object,
  • A BO collection,
  • A navigation object
  DATA: lr_desc_object         TYPE REF TO if_bol_bo_property_access,
        lr_data_collection     TYPE REF TO if_bol_bo_col,
        lr_nav                 TYPE REF TO if_crm_ui_navigation_service.

 

In order to navigate to our entity, we need to create a descriptor object based on BOL entity using the class cl_crm_ui_descriptor_obj_srv

  CALL METHOD cl_crm_ui_descriptor_obj_srv=>create_entity_based
    EXPORTING
      ir_entity           = ir_entity
      iv_ui_object_action = 'B'
    RECEIVING
      rr_result           = lr_desc_object.

 

Next we need to create a BOL collection and add our descriptor object to it

  CREATE OBJECT lr_data_collection TYPE cl_crm_bol_bo_col.
  lr_data_collection->add( lr_desc_object ).

 

Lastly, we  create an instance of the navigation service and navigate to our entity

* get Instance of Navigation Service
  lr_nav = cl_crm_ui_navigation_service=>get_instance( ).

* navigate to Target Component
  IF lr_nav->is_dynamic_nav_supported( lr_desc_object ) EQ abap_true.
    lr_nav->navigate_dynamically( lr_data_collection ).
  ENDIF.

 

ABOUT Furkan Sönmez

www.linkedin.com/profile/view?id=122521475

RELATED POSTS

COMMENTS

comments powered by Disqus