Wednesday, October 9, 2013

Navigating between components

If your search list has a customer and you want to navigate to the BP details.

1. Get_P method
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = 'SOLDTO'.                               
WHEN if_bsp_wd_model_setter_getter=>fp_tooltip.
ENDCASE.

2. Get navigation index
cl_thtmlb_util=>get_event_info(
EXPORTING
iv_event = htmlb_event_ex
IMPORTING

ev_index = lv_index ).

* get entity without setting the current
lr_entity ?= me->typed_context->btqrslsord->get_bo_by_index(
iv_index = lv_index
iv_change_focus = abap_false )


3. How to call windows outbound plug from your view's outbound plug
lr_window = me->view_manager->get_window_controller( ).
lr_window->call_outbound_plug( iv_outbound_plug = '         '
                                                           iv_data_collection = iv_data_collection ).

4. To Navigate to an other account make sure, the respective object type is maintained in the outbound plug mappings in navigation bar links of your component.

5. Using the index, once the entity is obtained, create a descriptor object
  CALL METHOD cl_crm_ui_descriptor_obj_srv=>create_entity_based
    EXPORTING
      ir_entity           = lr_entity
      iv_ui_object_action = 'B'
    RECEIVING
      rr_result           = lr_nav_descr.


6. From the descriptor object,SAP understands what kind of BO you are working on. And it knows what kind of a object type you need to have in order to navigate to the respective overview page.

7. Now it checks whether you have the respective dynamic navigation set up for your component. For this make sure the BP_ACCOUNT object type is set up on your navigation bar outbound plug mappings.
IF lr_nav_serv->is_dynamic_nav_supported( ir_descriptor_object = lr_nav_descr ) EQ abap_true.

8. Add this descriptor object to your collection which holds your selected entity.

9.And call the method navigate_dynamically and give your collection.
lr_nav_serv->navigate_dynamically( iv_data_collection = iv_data_collection ).