Escolar Documentos
Profissional Documentos
Cultura Documentos
Applies to:
WebUI in SAP CRM 2007 and CRM 7.0. For more information, visit the Customer Relationship Management homepage.
Summary
WebUI Saved Searches is equivalent to the SAPGui report variant. Frequently used search criterion on the Component search screen can be saved with a name and subsequently be called back to avoid re-entering. If you are building a Z component, this article will guide you through on how to incorporate Save Searches into your component. Author: Peng Wah Ng
Author Bio
Peng Wah Ng has more than 10 years experience in SAP implementation and has played many roles; including project manager, solution architect, functional consultant in MM, SRM and CRM area and technical consultant. He has been involved in the CRM area for 6 years, since CRM 3.0. He is currently an independent senior CRM consultant.
Table of Contents
Introduction to Saved Searches ......................................................................................................................... 3 Inside the Saved Searches ................................................................................................................................. 4 Step 1: Link Component Search Screen to Saved Search Registration ............................................................ 4 Adding CRM_SAVEDSEARCH in Component usage .................................................................................... 4 Adding Context Nodes in the Component Controller ...................................................................................... 5 Binding the Context Nodes in the Component Controller ............................................................................... 6 Filling Context Node with Entity during Initialization ....................................................................................... 6 Adding the Saved Search Field and Button .................................................................................................... 7 Test your Saved Search Functionality ............................................................................................................ 8 Step 2: Configure the Saved Search Launcher .................................................................................................. 8 Configure the Search Action Inbound Plug ..................................................................................................... 8 Define Central Search ..................................................................................................................................... 8 Test your Launcher Functionality .................................................................................................................... 8 Related Content .................................................................................................................................................. 9 Disclaimer and Liability Notice .......................................................................................................................... 10
Since this is your favorite search criterion, instead of entering them every time, you can save the criteria by giving it a name and then click the Save button. After this is done, you will immediately see the Variant appears on the Saved Searches drop down on the top right of the UI Frame.
You can select the Saved Search from the drop down and click Go. Immediately, you will see the result screen with you selection criteria. The best part is, you can execute that search regardless where you are in WebUI and you will be navigated to the result screen.
Even though it looks like all standard delivered WebUI query components has the saved search functionality, the Saved Searches functionality does not automatically integrate to a WebUI search component. If you build a custom WebUI search component, you need to carry out some steps to integrate your component to the central search functionality. This article will cover these steps.
Adding Context Nodes in the Component Controller To communicate with you component, the Saved Search needs to bind to your component controller via two context nodes.
Value Node Addition source code required in this method The first one is a model node that contains the same query BOL object you are using in your search view. The context node will hold the search criteria entered and passed to the Saved Search component. The second one is value node contains one field, UI_OBJECT_TYPE with data type of BSP_DLC_OBJECT_TYPE. The following source needs to be put in the IF_BSP_MODEL~INIT method of the context. Make sure you replace the <UI Object Type>. If you are using standard UI object, the value should be from table BSP_DLC_OBJ_TYPE (e.g. BT115Q_SLSQ if you are using quotation). If you created a Z UI object type, then this value should be from table BSPC_DLC_OBJ_TYPE.
METHOD if_bsp_model~init. TYPES: BEGIN OF ltype_attr_struct, ui_object_type TYPE bsp_dlc_object_type, END OF ltype_attr_struct. DATA: lv_struct_ref TYPE REF TO ltype_attr_struct, lv_value_node TYPE REF TO cl_bsp_wd_value_node, lv_bo_coll TYPE REF TO if_bol_bo_col. super->if_bsp_model~init( id = id owner = owner ). CREATE DATA lv_struct_ref. CREATE OBJECT lv_value_node EXPORTING iv_data_ref = lv_struct_ref. CREATE OBJECT lv_bo_coll TYPE cl_crm_bol_bo_col. lv_bo_coll->add( lv_value_node ). lv_value_node->if_bol_bo_property_access~set_property_as_string( iv_attr_name ='UI_OBJECT_TYPE' iv_value = <UI Object Type> ). set_collection( lv_bo_coll ). ENDMETHOD.
Binding the Context Nodes in the Component Controller After the two component controllers context nodes are created, now we need to bind them to the Saved Search component via the component usage. In the WD_USAGE_INITIALIZE method of your component controller class, add the following code.
METHOD wd_usage_initialize. CASE iv_usage->usage_name. WHEN 'SavedSearchRegistration'. TRY. * Bind advanced search context node CALL METHOD iv_usage->bind_context_node EXPORTING iv_controller_type = cl_bsp_wd_controller=>co_type_component iv_target_node_name = 'ADVANCEDSEARCH' iv_node_2_bind = 'ADVANCEDSEARCH'. CALL METHOD iv_usage->bind_context_node EXPORTING iv_controller_type = cl_bsp_wd_controller=>co_type_component iv_target_node_name = 'NAVIGATIONDESCRIPTOR' iv_node_2_bind = 'NAVIGATIONDESCRIPTOR'. CATCH cx_root. RETURN. ENDTRY. ENDCASE. ENDMETHOD.
Filling Context Node with Entity during Initialization During runtime, the component controller model node (ADVANCEDSEARCH in our example) needs to be initialized and filled with the instance of the search BOL entity so that it will hold the search criteria. This can be done in the DO_PREPARE_OUTPUT method of your search view controller class. Add the following code in the method.
DATA: lr_qs TYPE REF TO cl_crm_bol_dquery_service, lr_entity TYPE REF TO if_bol_bo_property_access, lr_comp TYPE REF TO zl_bt115qs__bspwdcomponen_impl.
IF iv_first_time = abap_true. * Get the query BOL entity from the views search BOL model node lr_qs ?= me->typed_context->btqslsquot->collection_wrapper->get_current( ). lr_comp ?= comp_controller. lr_comp->typed_context->advancedsearch->collection_wrapper->clear( ). * Saved search -> fill entity lr_comp->typed_context->advancedsearch->collection_wrapper->add( iv_entity = lr_qs ). ENDIF.
Adding the Saved Search Field and Button The final step is to add the Saved Search field and button on to your search view. The RegistrationWindow of CRMD_SAVEDSEARCH component provides the two elements and we have already created a Component Usage in previous step. We just have to include into our view set. 1. In the Runtime Repository, create a new View area and include the window into your Search-Result view set. Search-Result View Set Create new View Area Include Search Registration Window from Component Usage
2. Add the view in the View Sets html page with the following thtmlb code.
Test your Saved Search Functionality Up to this point, you should at be able to do the following: 1. The Save Search As field and the Save button should appear on your search screen. 2. Enter some value in your search parameters, give a Search name and click save. 3. You should see your Search name appear on the Search Launcher drop down on the top right. If everything works, the next step is to make the launcher launch the search screen and prepopulated the saved parameters.
The Object Type and Object Action entered here is going to be used in next step. Define Central Search This is the step telling the Launcher where to go in the navigation and which context node and Search BOL to populate the search parameters. The configuration path: SPRO > Customer Relationship Management > UI Frame > Define Central Search. Add a new entry as below,
Component Controller context node Your search BOL object As you can see, the configuration is by Navigation Bar profile. You need to add this configuration for all the Navigation Bar profile that you are going to use. Test your Launcher Functionality Login to the WebUI and make sure you Business Role is tied to the right Navigation Bar profile. If you already have saved a search in the previous step, you can select it from the launcher and click Go and it should navigate immediately to your components search screen with the parameters pre-filled.
Related Content
CRM WebClient UI Wish List CRM 2007 : How to publish user saved search to all users in a business Role Save Search As option in Webui for custom Z component For more information, visit the Customer Relationship Management homepage.