Escolar Documentos
Profissional Documentos
Cultura Documentos
1 INTRODUCTION...................................................................................................................3
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.
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.
Open the View Layout and use the thtmlb: inputfield tag at the appropriate position.
<thtmlb:inputField id = SALES_ORG"
helpId = CRM_ORGMAN_SALES_ORG
helpInputFields = SALES_ORG= SALES_ORG
helpOutputFields = SALES_ORG= SALES_ORG
value = "//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.
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.
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.
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 Page 7 of 24 Created: 20.10.2012
Author: Sanjoy Saha Printed: 01.07.2004 15:58
in tabular form.
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 mapping of input and output will be different depending on the context in which we
want to implement the F4 help.
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)
ls_map-context_attr = 'STRUCT.COUNTRY'.
ls_map-f4_attr = 'LAND1'.
APPEND ls_map TO lt_inmap.
APPEND ls_map TO lt_outmap.
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.
Scenario 4: Send the values which are not present on the UI to refine 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 Page 11 of 24 Created: 20.10.2012
Author: Sanjoy Saha 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.
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 Page 13 of 24 Created: 20.10.2012
Author: Sanjoy Saha 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.
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.
rv_valuehelp_descriptor = rv_valuehelp_descriptor.
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
*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.
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)
Steps:
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,
FIELD-SYMBOLS:
<list> 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.
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.
Another Example:
Data:
rec_map-context_attr = 'VKORG'.
rec_map-f4_attr = 'KEY'
APPEND rec_map TO i_outmap.
ENDIF.
* Types
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.
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.
* DIVISION ************************
READ TABLE rt_result WITH KEY field = 'ZDIVISION' ASSIGNING
<rt_result>.
* DIS_CHANNEL *******************
READ TABLE rt_result WITH KEY field = 'ZDISTCHASN' ASSIGNING
<rt_result>.