You are on page 1of 24

A Technical Guide about how to implement the Basic Search help in CRM WEB UI

Author: Sanjoy Saha Date: 28.08.2009

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 1 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

Table of Contents
1 INTRODUCTION...................................................................................................................3 2 DIFFERENT WAYS TO IMPLEMENT THE BASIC SEARCH HELP ..........................4 3 PROVIDE THE F4 HELP IN FREESTYLE MODE IN A VIEW......................................5 4 PROVIDE THE F4 HELP FOR A CONTEXT NODE ATTRIBUTE IN A VIEW WITH CONFIGURATION TAG..........................................................................................................6 4.1 PRINCIPLE.................................................................................................................................6 4.2 INITIAL STEP.............................................................................................................................6 4.3 EXAMPLE OF CODE: TO ADD A DROP DOWN INTO A FIELD.................................................................7 4.4 TO ADD A F4 HELP INTO A FIELD.................................................................................................8 4.4.1 Mapping Strategies:......................................................................................................8 4.5 SEARCH ID TYPE : REFERENCE STRUCTURE FIELD: EXAMPLE CODE...............................................15 4.6 EXAMPLE : SEARCH ID TYPE : DDIC NAME, USING A SPECIFIC SEARCH HELP ................................16 4.7 EXAMPLE : SEARCH ID TYPE : REFERENCE DATA ELEMENT ........................................................18 IF WE HAVE A DATA ELEMENT, WHERE A DDIC F4 HELP IS ASSIGNED TO IT, THEN WE CAN USE THIS ONE AS A SEARCH ID TYPE.......................................................................................................................18 4.8 EXAMPLE : CUSTOM SEARCH HELP............................................................................................19 THIS METHOD ALLOWS US TO CREATE OUR OWN CUSTOM SEARCH HELP..................................................19 4.9 PROVIDE AN F4 HELP FOR THE ADVANCED SEARCH........................................................................24

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 2 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

1 Introduction
It is a very common scenario where we need add a custom field into some assignment block (AB) of a standard CRM Component. Now if the field is a input enabled field, then as a CRM Developer it is required that we provide F4 help box for that field on that component. This document gives a technical overview about how to achieve this functionality. This document will only describe the general Basic Search Help concept. For Advanced Search Help concept please refer to the document A technical guide about how to implement advanced search help.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 3 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

2 Different ways to implement the Basic Search help


There are different ways to achieve this functionality.
1. Provide the F4 help in freestyle mode in a view (i.e. by using thtmlb: inputfield

tag)
2. Provide the F4 help for a context node attribute in a view with Configuration tag.

Search ID Type : Reference Structure Field Search ID Type : DDIC Name Search ID Type : Reference Data Element Using Custom Search Help

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 4 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

3 Provide the F4 help in freestyle mode in a view


Open transaction BSP_WB_CMPWB, then navigate to the component view which contains the attribute for which we need to add an F4 help.

Open the View Layout and use the thtmlb: inputfield tag at the appropriate position.
<thtmlb:inputField id helpId helpInputFields helpOutputFields value = = = = = SALES_ORG" CRM_ORGMAN_SALES_ORG SALES_ORG= SALES_ORG SALES_ORG= SALES_ORG "//TRADE/STRUCT.SALES_ORG"/>

The value Attribute is not a mandatory parameter. The Attribute ID is mandatory only if the value attribute is not assigned to the context node attribute or the name attribute is not used. If the value attribute is bound to the context node attribute and the ID attribute is not assigned, the ID will be set to the name of the node attribute. The output mapping of the above example would be then helpOutputFields = STRUCT.SALES_ORG = SALES_ORG Note: If the value attribute is not transferred properly, then check the output mapping i.e whether Output mapping points to a valid input field ID.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 5 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

4 Provide the F4 help for a context node attribute in a view with Configuration tag
4.1 Principle

Value helps can be implemented either as F4 helps or Drop Down List. The following information has to be provided to enable a F4 help on a field. The name of the search help or data element or Custom F4 to use for the current field F4 help The total list of the input mapping that can be used as search criteria. The list of output mapping that indicated in which field(s) the selected values(s) will be transferred after the search The type of search help we want to develop.

4.2

Initial Step

In order to add a value help into a field, the first step is to generate the V_GETTER and P_GETTER method of the fieldname. Then the required code will be implemented in the context node method GET_V_FIELDNAME and GET_P_FIELDNAME.
The GET_P_FIELDNAME method is used to declare the type of search help required for

the field. If a drop down is required, then the following piece of code needs to be written into the GET_P_FIELDNAME method of the field.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 6 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

If a F4 help is required, then the following piece of code needs to be written into the GET_P_FIELDNAME method of the field.

4.3 Example of code: To add a drop down into a field.


Go to the GET_V_FIELDNAME method of the field after putting the above piece of code into the GET_P_FIELDNAME method. Then insert the following piece of code into it.

Note: a. Source Type should be equals to T, as we will show all the dropdown fields
A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha Page 7 of 24 Created: 20.10.2012 Printed: 01.07.2004 15:58

in tabular form. b. Method POPULATE_DROPDOWN_TABLE is used to populate the drop down table. Depending on the required functionality, we can either populate this table from the values maintained at the domain level of the field or by some other method. 4.4 To add a F4 help into a field.

There are three different ways by which we can a F4 search help into a field. The following information has to be provided to enable a F4 help on a field. The name of the search help or data element or Custom F4 to use for the current field F4 help The total list of the input mapping that can be used as search criteria. The list of output mapping that indicated in which field(s) the selected values(s) will be transferred after the search The type of search help we want to develop. Only the name and the output mapping is required. Two utility class have been created to simplify the definition of F4 Help: CL_BSP_WD_VALUEHELP_F4DESCR CL_BSP_WD_VALUEHELP_NAVDESCR (To navigate into another Component) The class CL_BSP_WD_VALUEHELP_F4DESCR supports the following Search ID types: HELP_ID_KIND_COMP (Search ID Type: Reference Structure Field) HELP_ID_KIND_NAME (Search ID Type: DDIC Name) HELP_ID_KIND_DTEL ( Search ID Type: Reference Data Element)
4.4.1 Mapping Strategies:

Regular Mapping: The mapping of input and output will be different depending on the context in which we want to implement the F4 help. Scenario 1: The F4 help is located directly in a view. The input and Output context attribute must be defined using the STRUCT. Prefix. In the following example both the input and output mapping are using context node attribute STRUCT.COUNTRY and are associated with the search help parameter LAND1 of Search help (H_T005_LAND) DATA: ls_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping, lt_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab.
A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha Page 8 of 24 Created: 20.10.2012 Printed: 01.07.2004 15:58

**Sent the TPR Rebate Recipient value as default value to the search help input mapping as well as to the output mapping

ls_map-context_attr = 'STRUCT.COUNTRY'. ls_map-f4_attr = 'LAND1'. APPEND ls_map TO lt_inmap. APPEND ls_map TO lt_outmap. *Create the search help CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr EXPORTING iv_help_id = 'H_T005_LAND' iv_help_id_kind = if_bsp_wd_valuehelp_f4descr=>help_id_kind_name iv_input_mapping = lt_inmap iv_output_mapping = lt_outmap.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 9 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

Scenario 2: The F4 help is located within a table view. In this scenario the syntax is different. The table[] prefix should be used and the index of the row where the F4 help is required, must also be provided. The below example creates two output mapping to the UNIT and 'UNIT_DESC' attributes. The IV_INDEX is transferred to the GET_V_FIELDNAME Method by the framework.
*Internal Table DATA : L_I_INMAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB, L_I_OUTMAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB. *Structure DATA : L_S_MAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING, L_V_STR_INDEX TYPE STRING. * incase of table view index is provided by thr framework L_V_STR_INDEX = IV_INDEX. CONDENSE L_V_STR_INDEX. CONCATENATE 'table[' L_V_STR_INDEX '].UNIT' INTO L_S_MAP-CONTEXT_ATTR. CONDENSE ls_map-context_attr NO-GAPS. L_S_MAP-F4_ATTR = 'UNIT'. APPEND L_S_MAP TO L_I_INMAP. CONCATENATE 'table[' L_V_STR_INDEX '].UNIT' INTO L_S_MAP-CONTEXT_ATTR. L_S_MAP-F4_ATTR = 'UNIT'. APPEND L_S_MAP TO L_I_OUTMAP. CONCATENATE 'table[' L_V_STR_INDEX '].UNIT_DESC' INTO L_S_MAP-CONTEXT_ATTR. L_S_MAP-F4_ATTR = 'UNIT_DESC'. APPEND L_S_MAP TO L_I_OUTMAP. CREATE OBJECT RV_VALUEHELP_DESCRIPTOR TYPE CL_BSP_WD_VALUEHELP_F4DESCR EXPORTING IV_HELP_ID = '/GLB/CGTGDE_UOM_SHELP' IV_HELP_ID_KIND = 'N' IV_INPUT_MAPPING = L_I_INMAP IV_OUTPUT_MAPPING = L_I_OUTMAP IV_TRIGGER_SUBMIT = ABAP_TRUE.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 10 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

Scenario 3: The F4 help is located within a tree. If the F4 help is used within a tree, then the syntax is different. It includes, the prefix table[], the index of the row and the name of the tree. The next example creates one output mapping to the UNIT attribute using a tree. The IV_INDEX is transferred to the GET_V_FIELDNAME Method by the framework.
*Internal Table DATA : L_I_INMAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB, L_I_OUTMAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB. *Structure DATA : L_S_MAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING, L_V_STR_INDEX TYPE STRING. CONCATENATE 'firsttree_table[' L_V_STR_INDEX '].UNIT' INTO L_S_MAPCONTEXT_ATTR. L_S_MAP-F4_ATTR = 'UNIT'. APPEND L_S_MAP TO L_I_OUTMAP.

Scenario 4: Send the values which are not present on the UI to refine the search. This is possible by using a constant with input mapping as follows: The following example shows, how we have passed the ACCOUNT GROUP value for the search.
*Data Declaration DATA: ls_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping, lt_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab. **Sent the TPR Rebate Recipient value as default value to the search help input mapping as well as to the output mapping ls_map-context_attr = 'STRUCT.ZZ_REB_RECIPIENT'. ls_map-f4_attr = 'CUSTOMER_NO'. APPEND ls_map TO lt_inmap. APPEND ls_map TO lt_outmap. *Sent the TPR Sales Org value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.SALES_ORG'. ls_map-f4_attr = 'SALES_ORG'. APPEND ls_map TO : lt_inmap. **Sent the TPR Dist. Channel value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.DIS_CHANNEL'. ls_map-f4_attr = 'CHANNEL'. APPEND ls_map TO : lt_inmap.
A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha Page 11 of 24 Created: 20.10.2012 Printed: 01.07.2004 15:58

*Sent the TPR Division value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.DIVISION'. ls_map-f4_attr = 'DIVISION'. APPEND ls_map TO : lt_inmap. *Sent the Account Group, which is not present in UI to the search help input mapping ls_map-context_attr = '\''Z003\'''. ls_map-f4_attr = 'ACCOUNT_GROUP'. APPEND ls_map TO : lt_inmap. *Create the search help CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr EXPORTING iv_help_id = '/GLB/CGTGD_REBREC_ACC' iv_help_id_kind if_bsp_wd_valuehelp_f4descr=>help_id_kind_name iv_input_mapping = lt_inmap iv_output_mapping = lt_outmap.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 12 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

Context-sensitive mappings: At the time of using a search help, it is possible to pass the initial values from the UI to the value help and to limit the number of records sent back by the F4 help. In the following example, we can see that in the SH definition we have 18 search parameters. The CUSTOMER_NO , SALES_ORG, CHANNEL, DIVISION have the IMP column checked. This means they can be used as an input mapping and will be used as an initial search parameter.

If the Search Help is defined as being a dialog of type Dialog with value restriction, the F4 will initially display the search criteria with the initial values automatically added. If the dialog is of type display values immediately, the help values will be automatically displayed using the input mapping to limit the result. When the search help has multiple IMP parameters, we can also create the same number of input mapping in the
A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha Page 13 of 24 Created: 20.10.2012 Printed: 01.07.2004 15:58

V-Method of the context node attribute that will have an F4 value help. For example in the above search CUSTOMER_NO , SALES_ORG, CHANNEL, and DIVISION the following input mapping could have been created.
**Sent the TPR Rebate Recipient value as default value to the search help input mapping as well as to the output mapping ls_map-context_attr = 'STRUCT.ZZ_REB_RECIPIENT'. ls_map-f4_attr = 'CUSTOMER_NO'. APPEND ls_map TO lt_inmap. APPEND ls_map TO lt_outmap. *Sent the TPR Sales Org value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.SALES_ORG'. ls_map-f4_attr = 'SALES_ORG'. APPEND ls_map TO : lt_inmap. **Sent the TPR Dist. Channel value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.DIS_CHANNEL'. ls_map-f4_attr = 'CHANNEL'. APPEND ls_map TO : lt_inmap. *Sent the TPR Division value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.DIVISION'. ls_map-f4_attr = 'DIVISION'. APPEND ls_map TO : lt_inmap.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 14 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

4.5 Search ID Type : Reference Structure Field: Example code


In this case we can either map a check table to the structure or a DDIC search help. If we are using a check table, we will get all the records for our F4 help, without the possibility to restrict the selection. The below structure has a field called CURRENCY, where a check table TCURC has been assigned.

To use this method for F4 help, we have to adjust the following variables. LS_MAPPING_CONTEXT_ATTR (Context Attribute) LS_MAPPING_F4_ATTR (help parameter) IV_HELP_ID (Structure field referenced)
DATA: ls_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping, lt_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab. ls_map-context_attr = 'struct.currency'. ls_map-f4_attr = 'KEY'. APPEND ls_map TO: lt_inmap, lt_outmap. CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr EXPORTING iv_help_id = 'CRM_MKTPL_CAMPAIGN-CURRENCY' iv_help_id_kind = if_bsp_wd_valuehelp_f4descr=>help_id_kind_comp iv_input_mapping = lt_inmap iv_output_mapping = lt_outmap. rv_valuehelp_descriptor = rv_valuehelp_descriptor.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 15 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

4.6 Example : Search ID Type : DDIC name, using a specific search help
For this example we are using the DDIC Search help /GLB/CGTGD_REBREC_ACC, which has the import parameter CUSTOMER_NO. This parameter has been used (as a search help parameter) in the method. All the other fields defined in the search help can be used as output mapping, even if the column is not visible in UI.

To use this method for F4 help, we have to adjust the following variables. LS_MAPPING_CONTEXT_ATTR (Context Attribute) LS_MAPPING_F4_ATTR (help parameter) IV_HELP_ID (Name of the DDIC F4 help)
*Data Declaration DATA: ls_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping, lt_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab. **Sent the TPR Rebate Recipient value as default value to the search help input mapping as well as to the output mapping
A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 16 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

ls_map-context_attr = 'STRUCT.ZZ_REB_RECIPIENT'. ls_map-f4_attr = 'CUSTOMER_NO'. APPEND ls_map TO lt_inmap. APPEND ls_map TO lt_outmap. *Sent the TPR Sales Org value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.SALES_ORG'. ls_map-f4_attr = 'SALES_ORG'. APPEND ls_map TO : lt_inmap. **Sent the TPR Dist. Channel value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.DIS_CHANNEL'. ls_map-f4_attr = 'CHANNEL'. APPEND ls_map TO : lt_inmap. *Sent the TPR Division value as default value to the search help input mapping ls_map-context_attr = 'STRUCT.DIVISION'. ls_map-f4_attr = 'DIVISION'. APPEND ls_map TO : lt_inmap. *Sent the Account Group, which is not present in UI to the search help input mapping ls_map-context_attr = '\''Z003\'''. ls_map-f4_attr = 'ACCOUNT_GROUP'. APPEND ls_map TO : lt_inmap. *Create the search help CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr EXPORTING iv_help_id = '/GLB/CGTGD_REBREC_ACC' iv_help_id_kind if_bsp_wd_valuehelp_f4descr=>help_id_kind_name iv_input_mapping = lt_inmap iv_output_mapping = lt_outmap.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 17 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

4.7 Example : Search ID Type : Reference Data Element


If we have a data element, where a DDIC F4 help is assigned to it, then we can use this one as a Search ID Type.

To use this method for F4 help, we have to adjust the following variables. LS_MAPPING_CONTEXT_ATTR (Context Attribute) LS_MAPPING_F4_ATTR (help parameter) IV_HELP_ID (name of the Data Element)

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 18 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

4.8 Example : Custom Search Help


This method allows us to create our own custom search help. Steps: 1. Create a custom class that implements the IF_BSP_WD_CUSTOM_F4_CALLBACK interface. 2. This class will be used by the F4 controller to retrieve the values. 3. The method RETRIEVE_CUSTOM_VALUES of this class will have the following parameters: CT_RESULTS_TAB : Internal table containing the values to display on the F4 help. Only KEY/VALUE list is supported. IR_CUSTOM_REF : Reference of an object that can be used to retrieve the data. IS_SEARCH_HELP : This can be used to retrieve the search parameters.
METHOD if_bsp_wd_custom_f4_callback~retrieve_custom_values. DATA: lv_descr TYPE crmt_description, ls_results TYPE shsvalstr, ls_btorgset TYPE crmst_orgset_btil, lt_f4_list TYPE crmt_orgman_channel_ord_f4_tab, lr_entity FIELD-SYMBOLS: <list> TYPE REF TO cl_crm_bol_entity. TYPE crmt_orgman_channel_ord_f4.

IF ir_custom_ref IS BOUND. TRY. lr_entity ?= ir_custom_ref. CATCH cx_sy_move_cast_error. ENDTRY. ENDIF. IF lr_entity IS BOUND. TRY. TRY. lr_entity->get_properties( IMPORTING es_attributes = ls_btorgset ). CATCH cx_crm_cic_parameter_error. ENDTRY. CATCH cx_sy_ref_is_initial cx_sy_move_cast_error cx_crm_genil_model_error. ENDTRY. ENDIF. CALL METHOD cl_crm_orgman_services=>order_sale_channel_f4 EXPORTING iv_sales_org = ls_btorgset-sales_org IMPORTING et_f4_list = lt_f4_list.
A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha Page 19 of 24 Created: 20.10.2012 Printed: 01.07.2004 15:58

LOOP AT lt_f4_list ASSIGNING <list>. ls_results-key = <list>-dis_channel. CALL FUNCTION 'CRM_ORGMAN_DISTCHAN_T_SEL_CB' EXPORTING iv_distchan = <list>-dis_channel iv_language = sy-langu IMPORTING ev_description = lv_descr EXCEPTIONS description_not_found = 1 distchan_not_found = 2 OTHERS = 3. IF sy-subrc EQ 0. ls_results-value = lv_descr. ELSE. ls_results-value = <list>-dis_channel. ENDIF. INSERT ls_results INTO TABLE ct_results_tab. ENDLOOP. SORT ct_results_tab BY key ASCENDING. DELETE ADJACENT DUPLICATES FROM ct_results_tab. ev_key_title = text-001. ev_value_title = text-002. ev_key_title_length = 2. ev_value_title_length = 40. ENDMETHOD.

4. Re-definition of V-Method. The input and Output mapping are defined normally. We can add input and output mapping to fields in the UI or pass constants as input mapping as described in the Mapping Section. The main differences are the definition of the Search help ID and the possibility to add an extra input mapping, which is a constant that is used to retrieve a reference to an object that can be passed to the custom search help implementation class. Search Help ID : Custom Search help Ids are defined by placing the name of the custom class in between parenthesis, like, (/GLB/CL_JGTGD_F4_VKORG). Object Reference: It is also possible to pass an extra input mapping parameter to advise the F4 controller that an external object has to be used by the callback. This object is defined by adding the input mapping F4_ATTR = KEY_REF in the V-Method. Only one object can be passed to the callback. In addition to defining an input mapping for a reference, the actual reference to the object has to be stored. The class CL_BSP_WD_REFERENCE_TOOL stores all the references used by the F4 controller. In the following example , a reference to a custom controller is registered in CL_BSP_WD_REFERENCE_TOOL using the key CRM_THTMLB_COMP/CUPARTNER. The same key is reused in the V-Method and sent to F4 controller vial an input mapping.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 20 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

In the V-Method, associated with the input field , two mappings need to be defined like below. The first one is an output mapping to the STRUCT.BP_DESCRIPTION field and the second one is an input mapping indication that the custom search will use an object reference that has been previously saved using the CRM_THTMLB_COMP/CUPARTNER key using the CL_BSP_WD_REFERENCE_TOOL class.

Another Example: Data:


i_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, i_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab. rec_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping rec_map-context_attr = 'VKORG'. rec_map-f4_attr = 'KEY' APPEND rec_map TO i_outmap.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 21 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

l_o_entity ?= me->collection_wrapper->get_current( ). IF l_o_entity IS BOUND. *Create the search help CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr EXPORTING iv_help_id = (/GLB/CL_JGTGD_F4_VKORG) iv_help_id_kind = if_bsp_wd_valuehelp_f4descr=>help_id_kind_comp iv_input_mapping = i_inmap iv_output_mapping = i_outmap iv_trigger_submit ='' iv_object_ref = l_o_entity. ENDIF.

Example to add search help using node.


A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha Page 22 of 24 Created: 20.10.2012 Printed: 01.07.2004 15:58

* Reference variables DATA: l_v_value_help l_v_node * Types DATA:

TYPE REF TO cl_crm_mktpl_vh_bol_proxy, TYPE REF TO cl_crm_bol_entity.

ls_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping, lt_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab. l_v_node ?= me->collection_wrapper->get_current( ). ls_map-context_attr = 'STRUCT.TERR_ID' ls_map-f4_attr = TERRITORY'. APPEND ls_map TO: lt_inmap, lt_outmap. ls_map-context_attr = 'STRUCT.CUSTOMER_ID'. ls_map-f4_attr = 'PARTNER'. APPEND ls_map TO lt_inmap. ls_map-context_attr = CUSTOMER_ID_UI' ls_map-f4_attr = 'PARTNER' APPEND ls_map TO lt_outmap. CREATE OBJECT l_v_value_help EXPORTING ir_bol_abstr_bo = l_v_node iv_fieldname = STRUCT.CUSTOMER_ID' iv_search_help_id = CRM_MKTPL_BUPAP' it_inmap = lt_inmap it_outmap = lt_outmap iv_trigger_roundtrip = 'X' * Return the appropriate value help rv_valuehelp_descriptor = l_v_value_help.

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 23 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

4.9

Provide an F4 help for the advanced search

For the advanced search, we dont have to create a value help getter. Instead we have to redefine method GET_DQERY_DEFINITIONS in the implementation class of the view controller. Table RT_RESULT can be filled with the information relating to the F4 help.

* DIVISION ************************ READ TABLE rt_result WITH KEY <rt_result>.

field

'ZDIVISION'

ASSIGNING

CREATE OBJECT lr_value_help EXPORTING ir_bol_abstr_bo = lr_dquery_service iv_fieldname = 'DIVISION'. lr_value_help->get_dquery_result( CHANGING cs_result = <rt_result> ). * DIS_CHANNEL ******************* READ TABLE rt_result WITH KEY <rt_result>. field = 'ZDISTCHASN' ASSIGNING

CREATE OBJECT lr_value_help EXPORTING ir_bol_abstr_bo = lr_dquery_service iv_fieldname = 'DIS_CHANNEL'. lr_value_help->get_dquery_result( CHANGING cs_result = <rt_result> ).

A Technical Guide about how to implement the Basic Search help in CRM WEB UI Author: Sanjoy Saha

Page 24 of 24

Created: 20.10.2012 Printed: 01.07.2004 15:58

You might also like