Advanced Search Component for OneOrder Objects in SAP CRM 7.0

...Previous

28.  Go to the implementation class of Search View.

29.  Open the Super class (e.g. ZL_ZRAK_ORD_SEARCH) and change the inheritance of controller class with new class CL_BSP_WD_ADVSEARCH_CONTROLLER.

30.  Choose ‘Yes’ to keep the redefinitions of methods.

 

31.  Choose the context node BTQ1Order of View ZRAK_ORDERSRCH/Search and open Implementation Class ZL_ZRAK_ORD_SEARCH_CN00.

32.  Replace the super class inheritance with new class name CL_BSP_WD_CONTEXT_NODE_ASP.

33.  Copy the below code into the Search.htm page.

<%@page language="abap" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>

<thtmlb:advancedSearch 
id                = "advs0"
                       fieldMetadata     = 
"<%= controller->GET_DQUERY_DEFINITIONS( ) %>"
                       header            = 
"<%= BTQ1ORDER->get_param_struct_name( ) %>"
                       fieldNames        = 
"<%= controller->GET_POSSIBLE_FIELDS( ) %>"
                       values            = 
"//BTQ1ORDER/PARAMETERS"
                       maxHits           = 
"//BTQ1ORDER/max_hits"
                       onEnter           = 
"search"
                       ajaxDeltaHandling = 
"false" />
<br><br>
<thtmlb:
button id      = "search"
               
onClick = "search"
               
text    = "Search" />

34.  Open the Configuration tab of View ZRAK_ORDERSRCH/Search. Click on Edit button. Choose the search fields from available search criteria’s. Then click on ‘Save’ button.

35.  Open the Configuration tab of View ZRAK_ORDERSRCH/Result. Click on Edit button. Choose the fields to be displayed from available fields. Then click on ‘Save’ button.

 

36.  Test the Component. The following window with Search and Result views should appear.

37.  Create new event in View ZRAK_ORDERSRCH/Search.

38.  Enter event name ‘search’.

39.  The event handler method EH_ONSEARCH would appear as shown below.

 

40.  Copy the following code.

Reads the current context of BTQ1Order (search parameters) into dynamic query service object LR_QUERY_SERVICE. The method GET_QUERY_RESULT returns the one order collection into dynamic query result LR_RESULT. The result list collection will be assigned to result context node BTQR1Order.

method EH_ONSEARCH.

DATA: lr_query_service TYPE REF TO cl_crm_bol_dquery_service,
      lr_result 
TYPE REF TO if_bol_bo_col.

lr_query_service ?= me->typed_context->btq1order->collection_wrapper->get_current( ).
lr_result = lr_query_service->get_query_result( ).

CHECK lr_result is BOUND.

me->typed_context->btqr1order->set_collection( lr_result ).

endmethod.  

41.  The event names are Case Sensitive. Make sure to match the event name in Search.htm page and DO_HANDLE_EVENT method of its implementation class.

42.  Your Search component is ready to use.  Mention the search criteria (e.g. ID 5000000) and then either press enter key or click the ‘Search’ button. The result appears in result list.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image