Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

creating a link to another component in create oppurtunity view

Hi,

I want to create a link in create opportunity to traverse to create competitor view.How to go about?I have some idea of target ids but nothing more than that.

Looking forward to any help:)

Regards

Shilpi

Tags:
replied

Hi Shilpi,

There are two ways to get around what you want.

1. Conventional navigation using Navigational links.

2. Dynamic Navigation Descriptor.

Lets consider dynamic navigation descriptor first. If this does not work, then we can always achieve the result using normal navigation programming.

In the following code, i am navigating from BP_BPBT/AccountPriceRequestsOV( this is created view and not std.) to BT121H_SLSC/ContractOP this is std. view.

I belive that you have got the hyperlinked attribute already on yout view. if not then go to context node class in which you want this attribute and implement the GET_P as follows :

case iv_property.

when if_bsp_wd_model_sett_getter=>fp_fieldtype

rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.

when if_bsp_wd_model_sett_getter=>fp_onclick.

rv_value = 'create_compititor' .

endcase.

Now, create event handler EH_ONCREATE_COMPITITOR.

and write following code.

DATA: lv_index TYPE i.

DATA:

lr_col TYPE REF TO cl_crm_bol_bo_col,

lr_entity TYPE REF TO cl_crm_bol_entity,

lr_entity_bt TYPE REF TO cl_crm_bol_entity,

lr_core TYPE REF TO cl_crm_bol_core,

ls_attributes TYPE crmt_bsp_activity2_bp ,

lv_object_guid TYPE crmt_genil_object_guid,

lv_object_type TYPE BSP_DLC_OBJECT_TYPE,

lr_nav_descr TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS,

lr_nav_serv TYPE REF TO if_crm_ui_navigation_service.

CONSTANTS:

lc_ui_action TYPE crmt_ui_actions VALUE 'B'. "display YOU MUST USE the value for CREATE if you want to open in create mode. for this double click crmt_ui_actions and check whats the value for create.and use it in place of B..i think its A fro create and C for change mode.

WRITE SOME CODE TO RETRIEVE THE GUID OF THE OPPORTUNITY YOU ARE INTO

  • Step 1 Get the GUID of entity.

lv_object_guid = ls_attributes-object_key.

*Step 2 Get instance of the core and the root object. For dynamic navigation, root object wil always be BTORDER

lr_core = cl_crm_bol_core=>get_instance( ).

lr_entity_bt = lr_core->get_root_entity(

iv_object_name = 'BTOrder'

iv_object_guid = lv_object_guid ).

CHECK lr_entity_bt IS BOUND.

*Step 3 Create an collection object for navigation

CREATE OBJECT lr_col.

*Step 4 Add the entity to the navigation collection

lr_col->if_bol_bo_col~add(

iv_entity = lr_entity_bt

iv_set_focus = abap_true ).

*Step 5 Get object type

lv_object_type = cl_crm_uiu_ibase_tool=>get_bt_ui_object_type( lr_entity_bt ).

*Step 6 Create the navigation descriptor

cl_crm_ui_descriptor_obj_srv=>create_ui_object_based(

EXPORTING iv_ui_object_type = lv_object_type

iv_ui_object_action = lc_ui_action

RECEIVING rr_result = lr_nav_descr ).

CHECK lr_nav_descr IS NOT INITIAL.

*Step 7 Insert the navigation descriptor in navigation collection at position 1

lr_col->if_bol_bo_col~insert( iv_bo = lr_nav_descr

iv_index = 1 ).

*Step 8 Register the current page in history for navigating back to it.

RAISE EVENT history_trigger .

*Step 9 Get an instance of the navigation service and navigate to the component dynamically

lr_nav_serv = cl_crm_ui_navigation_service=>get_instance( ).

lr_nav_serv->navigate_dynamically( iv_data_collection = lr_col ).

Save your event handler, activate and test.

Basically, the target view window must have default EDIT/CREATE INBOUND PLUGS. if you get error as no such pluf defined the just go to target component view window and add them. they are readily available.

Thanks & Regard,

Suchita

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question