Skip to Content

Dynamic Navigation

Navigation can be defined in the following 2 ways:

  1. 1) Direct mapping of Component/Window/Outbound plug to Component /Window/Inbound Plug. 
  2. 2) Fully Generic navigation is for component that cannot define specific outbound plug since their outbound plug is generic means target is not defined. In fully generic navigation target is defined during run time.

      Flow: logical link id -> navigation via a descriptor object

Implementation

First step to create dynamic navigation is to create navigational link.

Go to SPRO transaction

SAP reference IMG->Customer Relationship Management->UI-Framework->Technical Role definition

  ->Define work area component repository.

Click on new entries and give your component name, window name and description and then save it.

After saving select your component name and click on inbound plug definition.

Target-ID: Name of target id is user defined means user can give any name.

Inbound Plug: Select inbound plug from f4 help. This f4 help comes automatically because in component definition you have given the name your component name.

Object Type:

  1. Obj.Action: It decides that after navigation our component should open in either in edit mode, display, search, or create mode.

After filling all these value save it.

Now, Click on define navigation bar profile.

                   

Click on Define navigation Bar Profile and click on new entries.

Nav Bar Profile : It is user defined name.

Link Id: Link Id is the name of logical link id name.

After filling these values save it select your nav bar profile name and click on define generic outbound plug mappings and click on new entries.

Object Type: Give name of your object type which you have given in transaction define work area component repository.

  1. Obj.Action: Select value from drop down list. If you want that after navigation your component should open in display mode then select display or if you want open edit mode then select edit option.

Target Id: Give target name as you have given in transaction work area component repository.

Write this code on any event handler method of ui.

DATA: lr_current TYPE REF TO if_bol_bo_property_access,
lr_col               TYPE REF TO if_bol_bo_col,
lr_desc_object       TYPE REF TO if_bol_bo_property_access,
lr_nav               TYPE REF TO if_crm_ui_navigation_service,
lr_data_collection   TYPE REF TO if_bol_bo_col,
lv_guid              TYPE crmt_genil_object_guid,
lr_entity            TYPE REF TO cl_crm_bol_entity,
lr_core              TYPE REF TO cl_crm_bol_core,
lr_root              TYPE REF TO cl_crm_bol_entity.

lr_current = me->typed_context->docflow->collection_wrapper->get_current( ).
CHECK lr_current IS BOUND.
lv_guid = lr_current->get_property_as_string(
iv_attr_name      = 'OBJKEY_A' ).
lr_core ?= cl_crm_bol_core=>get_instance( ).

****  get root entity
lr_entity ?= lr_core->get_root_entity( iv_object_name 'BTOrder'
iv_object_guid = lv_guid  ).

CHECK lr_entity IS BOUND.
****    Create UI based Entity
CALL METHOD cl_crm_ui_descriptor_obj_srv=>create_entity_based
EXPORTING
ir_entity           = lr_entity
iv_ui_object_type   = 'CRM_SRQM_INCIDENT'
iv_ui_object_action = 'B'            "display
RECEIVING
rr_result           = lr_desc_object.

****    Get Instance of Navigation Service
lr_nav = cl_crm_ui_navigation_service=>get_instance( me ).
****    Navigate to Target Component
IF lr_nav->is_dynamic_nav_supported( lr_desc_object ) = abap_true.
****      Create a BOL collection to be passed to the inbound plug of
****      the Called component
CREATE OBJECT lr_data_collection
TYPE
cl_crm_bol_bo_col.

****    Add the UI Descriptor the BOL Collection
lr_data_collection->add( lr_desc_object ).
lr_nav->navigate_dynamically( lr_data_collection ).

ENDIF.

You need to change only object type, object action and your root object name in above code.






Tags:
Former Member

No comments