关于search help exit

本文转自:http://blog.csdn.net/chuckth/article/details/5736802

 

1. 机能作用

                   Search Help Exit是用于对标准帮助进行扩充,以便与更加灵活的使用.

2. 使用场合

标准的Search Help其本身就可以进行一些简单的动态表示设定,比如:对选择条件的初期值进行设定(固定值,SAP Memory params(BUK)等.

但是,比如选择条件并非是DB字段的话,就需要用Search Help Exit Module进行扩充了.

3. 使用方法

                   - 执行T-cd:SE11

- 检索Help设定画面的[检索Help Exit]中输入Search Help Exit Module名

- 执行T-cd:SE37,进入Module Editer

- Help Exit Module的编写

 Module模版可以拷贝自既存的标准Module[F4IF_SHLP_EXIT_EXAMPLE]

 

实例

 

FUNCTION F4IF_SHLP_EXIT_EXAMPLE.

*"----------------------------------------------------------------------

*"*"Lokale Schnittstelle:

*"  TABLES

*"      SHLP_TAB TYPE  SHLP_DESCT

*"      RECORD_TAB STRUCTURE  SEAHLPRES

*"  CHANGING

*"     VALUE(SHLP) TYPE  SHLP_DESCR

*"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL

*"----------------------------------------------------------------------

 

* EXIT immediately, if you do not want to handle this step

  IF CALLCONTROL-STEP <> 'SELONE' AND

     CALLCONTROL-STEP <> 'SELECT' AND

     " AND SO ON

     CALLCONTROL-STEP <> 'DISP'.

     EXIT.

  ENDIF.

 

*"----------------------------------------------------------------------

* STEP SELONE  (Select one of the elementary searchhelps)

*"----------------------------------------------------------------------

* This step is only called for collective searchhelps. It may be used

* to reduce the amount of elementary searchhelps given in SHLP_TAB.

* The compound searchhelp is given in SHLP.

* If you do not change CALLCONTROL-STEP, the next step is the

* dialog, to select one of the elementary searchhelps.

* If you want to skip this dialog, you have to return the selected

* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to

* either to 'PRESEL' or to 'SELECT'.

  IF CALLCONTROL-STEP = 'SELONE'.

*   PERFORM SELONE .........

    EXIT.

  ENDIF.

 

*"----------------------------------------------------------------------

* STEP PRESEL  (Enter selection conditions)

*"----------------------------------------------------------------------

* This step allows you, to influence the selection conditions either

* before they are displayed or in order to skip the dialog completely.

* If you want to skip the dialog, you should change CALLCONTROL-STEP

* to 'SELECT'.

* Normaly only SHLP-SELOPT should be changed in this step.

  IF CALLCONTROL-STEP = 'PRESEL'.

*   PERFORM PRESEL ..........

    EXIT.

  ENDIF.

*"----------------------------------------------------------------------

* STEP SELECT    (Select values)

*"----------------------------------------------------------------------

* This step may be used to overtake the data selection completely.

* To skip the standard seletion, you should return 'DISP' as following

* step in CALLCONTROL-STEP.

* Normally RECORD_TAB should be filled after this step.

* Standard function module F4UT_RESULTS_MAP may be very helpfull in this

* step.

  IF CALLCONTROL-STEP = 'SELECT'.

*   PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB

*                       CHANGING SHLP CALLCONTROL RC.

*   IF RC = 0.

*     CALLCONTROL-STEP = 'DISP'.

*   ELSE.

*     CALLCONTROL-STEP = 'EXIT'.

*   ENDIF.

    EXIT. "Don't process STEP DISP additionally in this call.

  ENDIF.

*"----------------------------------------------------------------------

* STEP DISP     (Display values)

*"----------------------------------------------------------------------

* This step is called, before the selected data is displayed.

* You can e.g. modify or reduce the data in RECORD_TAB

* according to the users authority.

* If you want to get the standard display dialog afterwards, you

* should not change CALLCONTROL-STEP.

* If you want to overtake the dialog on you own, you must return

* the following values in CALLCONTROL-STEP:

* - "RETURN" if one line was selected. The selected line must be

*   the only record left in RECORD_TAB. The corresponding fields of

*   this line are entered into the screen.

* - "EXIT" if the values request should be aborted

* - "PRESEL" if you want to return to the selection dialog

* Standard function modules F4UT_PARAMETER_VALUE_GET and

* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.

  IF CALLCONTROL-STEP = 'DISP'.

*   PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB

*                           CHANGING SHLP CALLCONTROL.

*--------------对象DATA抽出检索画面未表示前的处理(改修代码一般在这里完成)------------------

* SHLP-FIELDDESCR里存放有检索表示画面中个项目的基本情况(项目名,类型,长度等)

* RECORD_TAB中存放有实际的表示DATA,并且各个表示项目内容被连接成一个字符串存放与STRING字段中

* 利用RECORD_TAB和SHLP-FIELDDESCR就可以对表示DATA进行该修了

. 读取某个项目的基本情况

READ TABLE SHLP-FIELDDESCR…

. 取得该项目在RECORD_TAB-STRING中的开始位置与长度

         OFFSET = SHLP-FIELDDESCR-OFFSET / 2

         OUTPUTLEN = SHLP-FIELDDESCR-OUTPUTLEN

. 循环RECORD_TAB,取得RECORD_TAB中的每条数据的该当项目的值

RECORD_TAB-STRING+OFFSET(OUTPUTLEN).

 

    EXIT.

  ENDIF.

ENDFUNCTION.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值