cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic navigation from ZCOMP1 to ZCOMP2

Former Member
0 Kudos

Hi experts,

Hope you are all doing good!

This is the first time I'm working with the dynamic navigation. So, I'm just trying to understand how really it works with two custom components.

I've already searched this forum n got some info. But, I'm getting confused with the procedure. 

While calling the target component, I see the below code:

lr_window ?= me->view_manager->get_window_controller( ).

lr_window->call_outbound_plug( iv_outbound_plug = 'TOCOMP2' iv_data_collection = lr_data_collection ).

and in another thread, they used:

lr_navigation = cl_crm_ui_navigation_service=>get_instance( ).

CHECK lr_navigation IS BOUND.

lr_navigation->navigate_dynamically( lr_col ).

Can someone help with the difference between these methods?  I really need this to understand clearly before proceeding further.

I would really appreciate if someone can provide the generic procedure to achieve this. Thank you a lot.

-Ezhno.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sumeet,

Thank you for your response.

I'm referring to your response in another thread:

You mentioned:

  lr_nav_srv->navigate_dynamically( iv_data_collection ).

  lr_window = me->view_manager->get_window_controller( ).

  lr_window->call_outbound_plug( iv_outbound_plug = 'DEFAULT' iv_data_collection=iv_data_collection ).


The first statement is enough to navigate to the target component dynamically. Is it correct?

I am not able to  understand why the next two statements are used. Can you please explain the use of those two statements?


Thank you.


-Ezhno.


sumeet_gehlot
Contributor
0 Kudos

Hi Maren,

First statement ( lr_nav_srv->navigate_dynamically( iv_data_collection ) is enough to navigate to the target component if spro customizing is done correctly.

Below code is actually not required as per your concern the above thread.

  lr_window = me->view_manager->get_window_controller( ).

  lr_window->call_outbound_plug( iv_outbound_plug = 'DEFAULT'iv_data_collection=iv_data_collection ).


This is also an another approach that you are calling to the window outbound plug and there will

  me->fire_outbound_plug( iv_outbound_plug   = 'DEFAULT'

                           iv_data_collection = iv_data_collection ).

which will also navigate the same view as per as customizing in spro.

So basically there are multiple ways to navigate.

Regards,

Sumeet

sumeet_gehlot
Contributor
0 Kudos

Hi Maren,

  - for more Info.

Dynamic navigation will be perform only if they have generic mapping entry in navigation bar profile in spro. At runtime webui picks the target id and calls the inbound plug to the target link.

if you are trying to perform navigation on the standard component, then you can directly check the config in spro and perform the navigation using a descriptor object.

and if its for the custom component then u have to define a workarea component repository

check my answer in below thread . Use first three screen shots to define work area repository

Once u have defined your target id for your ZComponent , then u can create a new your new mapping in spro for your ZComponent, like  below screenshot and perform dyanmic navigation.

Now to perform dynamic navigation sample code .

   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 if_bol_bo_property_access,
        lr_col           type ref to cl_crm_bol_bo_col.



*     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.


As per as configurations navigate_dynamically will check the spro config as it will navigate to the target id of the BP as display mode i.e on overviewpage.


Now comes to the first question......


lr_window ?= me->view_manager->get_window_controller( ).

lr_window->call_outbound_plug( iv_outbound_plug = 'TOCOMP2' iv_data_collection = lr_data_collection ).


here you are trying to get the instance of the window controller and then your are calling to the Window Outbound plug and passing the collection using a navigation_link.

where inbound and outbound plugs are defined.

Steps :

Create an outbound plug on the source view

Create an inbound plug for target view.

Create an event handler for the navigation event

Method EH_xxx.

Op_xxx.()

ENDMETHOD.

Create a navigation link between the source and target view.

In the outbound plug, call following code snippet.

Me->view_manager->navigate(source_rep_view =  me->rep_view

Outbound plug = <navlink>) or you can call the window plugs and perform

Create an inbound plug for target view.

If you have any questions, let me know.

Regards,

Sumeet Gehlot




Former Member
0 Kudos

Hi Maren,

First method is navigating from component to component by creating Navigation link between the two windows. ie., in this case 'TOCOMP2' is navigation link.

Second method is Dynamic navigation.

Here first we maintain our component in SPRO settings .

a. component in workarea component repository by giving a Target id , object type.

b. Later going to navigation bar profile and maintaining that object type , tagrget id in the generic oubound plug

c. Now in the source component we get the instance of the target component by using class

    cl_crm_ui_descriptor_srv by passing object type.

d.

lr_navigation = cl_crm_ui_navigation_service=>get_instance( ).

CHECK lr_navigation IS BOUND.

lr_navigation->navigate_dynamically( lr_col ).


e. lr_col is the collection which we pass to the target component. also to lr_col we will add the target component instance which we get.



Regards,

Dinesh Gurram