Filtering F4 Help Values in Table Control, Based On Other Field Value

原创 2015年11月19日 18:30:17

This BoK provides info on how to create an F4 help by filtering the values based on the value entered in another field (By capturing the values entered in the field without hitting the enter key) in a table control.
 
The regular procedure of fetching theF4 help values does help here But only when <enter> key is pressed after entering the value in the first field. To avoid hitting the <enter> key we need to capture the value entered in the first field dynamically.

Let's consider a scenario where I have two fields in my table control & the F4 help values for the second field depends on the value entered in the first field.

 1. Airline code (SFLIGHT-CARRID)

 2. Flight connection number (SFLIGHT-CONNID)

Let’s select an Airline code

Now the F4 help should be filtered for second field ‘Flight connection number’ based on the ‘Airline code’ selected (without hitting the enter key)

Before selecting the airline code:

 

After filtering,based on the value selected in first field

The procedure toaccomplish the same is detailed below

1.    In the PAI of the table control dynpro, Use the event 'Process onvalue-request'. Under this event use the syntax shown below.

           PROCESS ON VALUE-REQUEST.
                       FIELD <table control field name> MODULE <module name>

           Example:

           PROCESS ON VALUE-REQUEST.
               FIELDwa_add-connid MODULE f4help.

                Where wa_add-connid is my tablecontrol field name.

Note: All thecode shown below is to be written in module ‘f4help’ as mentioned in theprevious step

2.    We need to determine the cursor position to know at which row the F4 help ispressed. To know the row index, use the Function module 'DYNP_GET_STEPL'. ThisFM returns the current line index (Row Index where the F4 help is pressed). Usethe following code in the POV module

       CALL FUNCTION 'DYNP_GET_STEPL'
          IMPORTING
             povstepl =v_index.   (v_index  is a  variable  to hold  the  index  value)

3.    To hold the current screen values i.e. the value entered in the first fieldCARRID, declare an internal table and a work area of type 'dynpread' structure.The ‘stepl’ field of the structure is used to store the row index where the f4help is needed and the field ‘fieldname’ is used to store the field name whosevalues are to be read dynamically.

4.    Pass the current line index to the work area field 'stepl' and the field name bywhich the f4 help needs to be filtered to 'fieldname' to the internal table(Code in f4help module).

    Wa_dynpread-stepl = v_index.

    Wa_dynpread-fieldname = 'WA_ADD-CARRID'.

    Append wa_dynpread TO it_dynpread.

5.    Use FM 'DYNP_VALUES_READ' by passing the report name: 'sy-repid' to dyname ,screen number : 'sy-dynnr' to dynumb and the dynpread internal table to'Tables' to read field contents on screen and transport field to help processor.

       CALL FUNCTION 'DYNP_VALUES_READ'
                  EXPORTING
                     dyname              = sy-repid
                     dynumb              = sy-dynnr
                     translate_to_upper   = 'X'
                 TABLES
                     dynpfields           = 
it_dynpread .

6.    The FM 'DYNP_VALUES_READ' fetches the value entered in the field 'Legreg'.  Select the flight connection number based onthe value in ‘FIELDVALUE’ in IT_DYNPREAD.

 READ TABLE it_dynpread INTO wa_dynpread WITH KEY stepl = v_dynindex.

   IF sy-subrc IS INITIAL.


     SELECTDISTINCT connid FROM sflight 

        INTO TABLE it_connid 

  WHERE carrid = wa_dynpread-fieldvalue

   ENDIF.

7.     Pass the internal table IT_CONNID to theFM 'F4IF_INT_TABLE_VALUE_REQUEST'.

        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
             retfield    = 'CONNID'
             dynpprog    = sy-repid
              dynpnr       = sy-dynnr
              dynprofield ='WA_ADD-CONNID'
             value_org   = 'S'
         TABLES
             value_tab   = it_connid.

Now the f4 helpvalues for the field 'connid' will be filtered based on the value entered in'carrid'.

 

 

 

Ajax跨域、Json跨域、Socket跨域和Canvas跨域等同源策略限制的解决方法

同源是指相同的协议、域名、端口,三者都相同才属于同域。不符合上述定义的请求,则称为跨域。 相信每个开发人员都曾遇到过跨域请求的情况,虽然情况不一样,但问题的本质都可以归为浏览器出于安全考虑下的同源策略...
  • freshlover
  • freshlover
  • 2015年03月12日 16:53
  • 57893

Lua脚本之语法基础快速入门

Lua的语法基础超级简单,非常易于上手,下面总结一些学习过程中的Lua语法基础:         在开始学习之前,先介绍一些最基本的概念,在Lua中具有一个代码块的概念,每个函数或者for循环等都是一...
  • eric_XJJ
  • eric_XJJ
  • 2013年07月02日 04:31
  • 14247

FindBugs规则整理

FindBugs是基于Bug Patterns概念,查找javabytecode(.class文件)中的潜在bug,主要检查bytecode中的bug patterns,如NullPoint空指针检查...
  • jdsjlzx
  • jdsjlzx
  • 2014年03月18日 17:37
  • 57395

F4 help functionality for a dynpro screen field using the PROCESS ON VALUE-REQUEST statement

Pressing the F4 button on a dynpro screen field brings up a list of possible values you can enter in...
  • champaignwolf
  • champaignwolf
  • 2016年08月04日 21:07
  • 282

Refreshing One Column based on the value of Another Column in ADFdi Table

Refreshing One Column based on the value of Another Column in ADFdi Table  原文地址:RefreshingOne Colum...
  • luyushuang
  • luyushuang
  • 2012年03月14日 21:27
  • 582

【跟着stackoverflow学Pandas】Select rows from a DataFrame based on values in a column -pandas 筛选

Select rows from a DataFrame based on values in a column -pandas 筛选 https://stackoverflow.com/quest...
  • tanzuozhev
  • tanzuozhev
  • 2017年08月05日 15:24
  • 7591

F4IF_FIELD_VALUE_REQUEST 和 F4IF_INT_TABLE_VALUE_REQUEST的不同

原文地址http://blog.csdn.net/liangziyisheng/article/details/6951941   F4IF_FIELD_VALUE_REQUEST主要功能是将表里...
  • JellyLin_SAP
  • JellyLin_SAP
  • 2012年09月04日 17:02
  • 2621

Value Ordering Heuristic for Solving Algorithm Based on the AC-4 Algorithm

  • 2010年10月15日 18:50
  • 254KB
  • 下载

Distributing Negative Messages in VANET Based on Meet-Table and Cloud Computing

  • 2018年01月10日 16:23
  • 13KB
  • 下载

The Research of Access Control Based on UCON in the Internet of Things

  • 2012年05月07日 08:47
  • 1.01MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Filtering F4 Help Values in Table Control, Based On Other Field Value
举报原因:
原因补充:

(最多只允许输入30个字)