Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 

 

Applies to:

 

SAP CRM 7.0, EHP1, EHP2 and EHP3

 

Summary

 

This document illustrates the usage of trasaction launcher in the business scenario where we have a field which is hyper link and on click of that the new window should open with that link using transaction launcher. However this is not most feasible way of handling this requirement, as in order to trigger the transaction launcher from click of button we need to add the transaction launcher as logical link to the Navigation bar profile(This is SAP bug as we can't navigate to logical link without adding to the naivgation bar profile) which is covered in the below sections. However the ideal way of doing this is using java script code window.open("<%= URL variable in ABAP %>","<%= sy-uzeit%>"); This will open the window as there are two parameters the first parameter is URL link which we need to open and the other is the time stamp which we need to in order to allow the session handling between two windows.If we don't do this it won't work after we click second time.

 

Author(s):

Rajwin Singh Sood

 

Company: Atos

 

Created on: 3rd July 2014

 

Author Bio

 

Rajwin Singh Sood is currently working as Team lead/Solution

Architect at Atos. He has got experience of about 10 years in SAP ABAP and SAP CRM web UI. He is also a

SAP CRM EHP2 Certified associated consultant. Prior to working with Atos he had worked with SAP India(SAP

Global Delivery), Capgemini , Accenture and Infosys. He worked in SAP CRM Web Ui in areas like BSP

enhancements, transaction launchers, BOL Programming, BRFPlus .


Scenario for transaction launcher to launch dynamic URL

I can't share the complete scenario however in order to illustrate the same I am using the example of quotation where a particular field called as external reference is first made as hyper link as per below screenshot:-

So as first step we just need to add the below code snippet to make this field as hyperlink:-

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 = 'SELECTLINK'.                              "#EC NOTEXT

  ENDCASE.

so on click we need to create event method EH_ONSELECTLINK as per below screenshot:-

Prepare the transaction launcher and logical link

go to SPRO->Customer Relationship Management->UI Framework->Technical Role Definition->Transaction Launcher->Define URL's and Parameters and then define URL ZDYNA_URL as per below screenshot:-

as per above screenshot we haven't mentioned any specific link as this will picked up from the value entered by end user, hence we have specified the Z class ZCL_DYNA_URL which will handle dynamic link this class while creating it using transaction se24 will have interface IF_CRM_IC_LTX_URL_ADMIN associated with it and will have method GET_URL_DATA which will come automatically once we activate and save the class we need to redefine the class and add the following code:-

METHOD if_crm_ic_ltx_url_admin~get_url_data.

  IF zl_bt115qh__sqhoverview_impl=>gv_open_link IS NOT INITIAL.

***now populate the URL to be opened

    cv_url = zl_bt115qh__sqhoverview_impl=>gv_open_link.

    CLEAR zl_bt115qh__sqhoverview_impl=>gv_open_link.

  ENDIF.

ENDMETHOD.

here we have global variable gv_open_link which I have defined as PUBLIC static variable and will be set while calling transaction launcher which is covered in detail in last section of this document.

after saving the link then we need to go to SPRO->Customer Relationship Management->UI Framework->Technical Role Definition->Transaction Launcher->Configure Transaction Launcher

Here we need to create a new transaction launcher with the ID Z_TL_DYN_LINK as per below screenshots:-

click on continue

Here we define the handler class for transaction launcher and again click on continue.

Here we need to pass on the URL which we created in the step associated with URL creation as described above and click on continue unitl we reach completion screen and then click on complete as per below screenshot:-

so we are done with the transaction launcher definition. Now we need to create the logical link with id Z_DYN_LK pointing to the transaction launcher created above using transaction CRMC_UI_NBLINKS as per below screenshot:-

now in order to set this logical link we need to first create work center ID ZWC_DYN_LK pointing to logical link and then set to the Nav bar profile with respect to the business role which you'll be using to login into WEBUI as per below screenshots:-

now assign this work center to the navbar profile as per below screenshot:-

Code to call the transaction launcher for dynamic link

Now we come to final part where in we need to call transaciton launcher pointing to the dynamic link created in above sections. Here we have created event method EH_ONSELECTLINK with reference to the above step. Now add the following code in order to call the transaction launcher:-

* Added by wizard: Handler for event 'SELECTLINK'
  DATA:     lv_open_link          TYPE string,
            lv_open_browser(5000) TYPE c,
            nav_service           TYPE REF TO if_crm_ui_navigation_service,
            lr_ent                TYPE REF TO cl_crm_bol_entity.

  lr_ent ?= me->typed_context->btsalesset->collection_wrapper->get_current( ).
  nav_service = cl_crm_ui_navigation_service=>get_instance( ).
  IF lr_ent IS BOUND.
    CALL METHOD lr_ent->if_bol_bo_property_access~get_property_as_value
      EXPORTING
        iv_attr_name = 'PO_NUMBER_SOLD'                     "#EC NOTEXT
      IMPORTING
        ev_result    = zl_bt115qh__sqhoverview_impl=>gv_open_link.
    IF zl_bt115qh__sqhoverview_impl=>gv_open_link IS NOT INITIAL.
      nav_service->navigate(
      iv_link_id         = 'Z_DYN_LK'                       "#EC NOTEXT
       ).
    ENDIF.
  ENDIF.

here we'll be using the navigation service class to navigate to the logical link which we have created using transaction CRMC_UI_NBLINKS(in the above steps)

before calling the logical link we need to set the value public static global variable gv_open_link which will contain the value of external reference field.

Testing in WEBUI

We just need to click on external reference field in webui as per below screenshots:-

after clicking new window opens with the hyper link from the external reference :-

3 Comments
Labels in this area