Navigate from an SAP Web UI application to a Fiori/UI5 application in the Fiori Launchpad

This code snippet shows how to navigate from a Web UI application to a Fiori/UI5 application. To test the coding insert a button with an event into your Web UI component. Paste the coding into the redefined event handler method.

⚠️ The coding only works if the Web UI application is displayed in the Fiori Launchpad

DATA: lt_parameters TYPE tihttpnvp.  
DATA: ls_parameter TYPE ihttpnvp.  
DATA: lr_nav_obj TYPE REF TO cl_wcf_navobject_flp.  
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.  
  
*--- ComponentData/StartUpParameters - Does the application require certain parameters?  
ls_parameter-name = 'ParameterA'.  
ls_parameter-value = 'A'.  
APPEND ls_parameter TO lt_parameters.  
  
ls_parameter-name = 'ParameterB'.  
ls_parameter-value = 'B'.  
APPEND ls_parameter TO lt_parameters.  
  
*--- Create the Navigation Link  
CREATE OBJECT lr_nav_obj.  
  
*--- Create the new FLP nagivation descriptor  
CREATE OBJECT lr_nav_descr TYPE cl_wcf_flp_nav_descriptor  
EXPORTING  
iv_navigation_object = lr_nav_obj  
iv_semantic_object = 'MySampleApplication' "semantic object of your application  
iv_semantic_action = 'display' "semantic action  
iv_local_field_name = ''  
* iv_application_hash = iv_application_hash  
it_parameters = lt_parameters "ComponentData/StartUpParameters  
iv_navigation_mode = cl_wcf_flp_nav_descriptor=>gc_nav_mode_explace. "Navigate inline? (gc_nav_mode_inplace) or in an new Tab? (gc_nav_mode_explace)  
  
  
CHECK lr_nav_descr IS BOUND.  
  
lr_navigation = cl_crm_ui_navigation_service=>get_instance( ).
  
CHECK lr_navigation IS BOUND.  
  
*--- Check whether navigation is supported  
CHECK lr_navigation->is_dynamic_nav_supported( lr_nav_descr ).  
  
  
*--- Navigate  
CREATE OBJECT lr_col.  
lr_col->if_bol_bo_col~add( iv_entity = lr_nav_descr ).  
lr_navigation->navigate_dynamically( lr_col ).

Credits

Leave a Reply

Your email address will not be published. Required fields are marked *