二维码

[教程] PROVIDING F4 HELP

Twilight发表于 2015-12-05 00:51Twilight 最后回复于 2015-12-05 00:51 [复制链接] 2742 0

Most of the times, providing F4 help for particular field at WEB UI level requires creating a search help in SE11 transaction.

Let us create one search help in SE11 first.

Go to the SE11 transaction and create one search help. Enter the values as shown in the below. Here we want provide a F4 help to the partner function field at search view.
webui F4 1.jpg

Selection method is a table name from which values will come.  Activate the search help.

Go to the UI component and go to the field for which F4 help has to be provided. Here we want to provide it for PARTNER FUNCTION field at search view.
Go and generate the v-GETTER method.
webui F4 2.jpg

Once method is generated,copy and paste the following code.
  1. METHOD get_v_partner_fct.

  2.   DATA:ls_map    TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping,
  3.        lt_inmap  TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab,
  4.        lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab.

  5.   ls_map-context_attr = 'STRUCT.PARTNER_FCT'.
  6.   ls_map-f4_attr      =  'PARTNER_FCT'.
  7.   APPEND ls_map TO: lt_inmap.

  8.   CLEAR ls_map.
  9.   ls_map-context_attr = 'STRUCT.PARTNER_FCT'.
  10.   ls_map-f4_attr      = 'PARTNER_FCT'.
  11.   APPEND ls_map TO: lt_outmap.

  12.   CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr
  13.     EXPORTING
  14.       iv_help_id        = 'ZPARTNERFCT'
  15.       iv_help_id_kind   = if_bsp_wd_valuehelp_f4descr=>help_id_kind_name
  16.       iv_input_mapping  = lt_inmap
  17.       iv_output_mapping = lt_outmap.

  18. ENDMETHOD.
复制代码

To make the developers work easy, SAP has provided one standard class CL_BSP_WD_VALUEHELP_F4DESCR. We just need to create one stance of this class by providing some information.
  • Help id : This is search help id that we created in se11.
  • Input mapping : to provide the mapping between the context node attribute and the attribute in the search help.
    Here we are providing the f4 help to the PARTNER FUCNTION field. so at line 9, we have given the ‘STRUCT.PARTNER_FCT’ to the input mapping’s CONTEXT_ATTR.  In the next line, we mapped it to the ‘PARTNER_FCT’ in the SE11 search help.
  • Outputmapping:  once user selects any value on the F4 help, we need to transfer the selected value back to the field. This information will be given in the output mapping.  In lines 14 & 15, we have done this by telling framework to transfer the value from the ‘PARTNER_FCT’ to the context node attribute ‘STRUCT.PARTNER_FCT’

Activate the method and test the application.
webui F4 3.jpg

Here we can see two fields at top, partner function, text to search entries. These fields are appeared here because we have given the values 1 and 2 in the SPos column in se11 while we created the search help. If we had left this column blank, then these fields won’t appear.

Select any value. Value will be automatically transferred to the partner function field.

We can every restrict the search by sending values as below .
'\''Z*\'''

Comment the ‘STRUCTU.PARTNER_FCT’ and uncomment above value in the line no 9. Activate the method and test the application. Your f4 will be shown as below.  All entries that start with Z will be searched.
webui F4 4.jpg
回复

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表