您好,欢迎来到尚车旅游网。
搜索
您的当前位置:首页sap_搜索帮助创建

sap_搜索帮助创建

来源:尚车旅游网


搜索帮助退出

搜索帮助描述标准输入帮助过程。在例外情况下,可能有必要偏离某些点,从这个标准。这种偏离标准也可在整个系统中,输入帮助过程看起来应该尽可能多。因此,搜索帮助退出只能用于异常。 搜索帮助出口是一个具有预定义接口的功能模块。搜索帮助出口在某些时候被帮助处理器调用。 帮助处理器的管理数据通过接口传递给搜索帮助退出。

您可以存储自己的程序逻辑,在搜索帮助退出中操作该管理数据。可以使用搜索帮助退出跳过输入帮助进程

F4UT_OPTIMIZE_COLWIDTH

搜索帮助出口f4ut_optimize_colwidth调整列宽命中列表中的列的内容。这是有意义的使用此搜索帮助退列的命中列表必须作出非常广泛的极端情况下(如名称字段),但通常他们将包含更小的值。

Code:

FUNCTION F4UT_OPTIMIZE_COLWIDTH.

*\"---------------------------------------------------------------------- *\"*\"LokaleSchnittstelle: *\" IMPORTING

*\" VALUE(PARAMETER_OPTIMIZE) TYPE C OPTIONAL *\" TABLES

*\" SHLP_TAB TYPE SHLP_DESCR_TAB_T *\" RECORD_TAB STRUCTURE SEAHLPRES *\" CHANGING

*\" REFERENCE(SHLP) TYPE SHLP_DESCR_T *\" REFERENCE(CALLCONTROL) TYPE DDSHF4CTRL

*\"---------------------------------------------------------------------- data fieldprop_Wa like ddshfprop. datadfies_wa like dfies. datai type i.

field-symbols: .

data: len type i, maxlen type i. DATA: value LIKE DDSHIFACE-VALUE,

param_tab LIKE DD32P-FIELDNAME OCCURS 0 WITH HEADER LINE.

RANGES params FOR fieldprop_wa-FIELDNAME.

* CHECK CALLCONTROL-STEP = 'DISP' or callcontrol-step = 'PRESEL'. checkcallcontrol-step = 'PRESEL1'.

IF PARAMETER_OPTIMIZE IS INITIAL.

CALL FUNCTION 'F4UT_PARAMETER_VALUE_GET'

EXPORTING

PARAMETER = 'PARAMETER_OPTIMIZE' IMPORTING

VALUE = value TABLES

SHLP_TAB = SHLP_TAB RECORD_TAB = RECORD_TAB CHANGING

SHLP = SHLP

CALLCONTROL = CALLCONTROL EXCEPTIONS

OTHERS = 2. IF SY-SUBRC = 0.

SPLIT value AT ',' INTO TABLE param_tab. ENDIF. ELSE.

SPLIT PARAMETER_OPTIMIZE AT ',' INTO TABLE param_tab. ENDIF.

params-OPTION = 'EQ'. params-SIGN = 'I'. LOOP AT param_tab.

params-LOW = param_tab. APPEND params. ENDLOOP.

sortshlp-fielddescr by fieldname.

loop at shlp-fieldprop into fieldprop_wa

where fieldname in params and shlplispos<> 0. read table shlp-fielddescr

with key fieldname = fieldprop_wa-fieldname binary search transporting no fields. checksy-subrc = 0. i = sy-tabix.

DFIES_wa-mask+7(1) = 'O'.

MODIFY shlp-fielddescr from DFIES_wa index i transporting mask+7(1). endloop. ENDFUNCTION.

每个搜索帮助出口必须有相同的接口功能模块f4if_shlp_exit_example(作为模式的所有搜索帮助出口被您可以在此功能模块的文档中找到有关该接口的更多信息。

F4IF_SHLP_EXIT_EXAMPLE

Code:

FUNCTION F4IF_SHLP_EXIT_EXAMPLE.

*\"---------------------------------------------------------------------- *\"*\"LokaleSchnittstelle: *\" 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. EXIT. ENDIF. ENDFUNCTION.

调用搜索帮助退出

如果将搜索帮助出口分配给搜索帮助,则帮助处理器在下列时间调用它: 在显示用于选择所需搜索路径的对话框之前。

它只是呼吁集体搜索帮助。使用搜索帮助退出,基本搜索集帮助可用的例如可以根据上下文进行。

在启动基本搜索帮助的F4过程之前 该调用于是否进入搜索条件的对话窗口出现或是否立即执行选择(例如,因为基本搜索帮助的即时值设在显示进入搜索条件的对话框之前 您可以影响对话框进入搜索条件或跳过它在这里。您也可以影响如何选择屏幕看起来。只有当没有直接选择的即时值显示没有设置)的热键触发调用 Before Selecting Data. 数据选择可以部分或完全从搜索帮助退出复制。如果不能用表或视图的SELECT语句来实现数据选择,这在显示命中列表之前。 您可以通过搜索帮助退出来影响此步骤中的命中列表的显示。您可以减少显示在这里的值的数目。 例如,您只能显示调用输入帮助的人具有授权的值。您也可以复制完整的命中列表从搜索帮助退出。 在将用户选择的值返回到输入模板之前。 如果控制进一步的事务流程取决于所选的值,此时可以进行干预。一个典型的例子是设置/获取参数。 搜索帮助飞行例子 搜索帮助飞行是用来寻找飞行数据。当他们寻找航班时,旅行社的工作人员通常需要知道航班上是否还有座的搜索帮助选择方法(表观说道,飞行和SPFLI)不直接包含此信息。选择方法只包含有关航班上可用座位并且已经保留了多少个座位。 从这一信息,搜索帮助出口sapbc_global_f4_sflight计算席位仍然可用的数量和在搜索帮助参数返回结因此可以显示在命中列表。 因此,在显示“命中列表”之前,您只需为“搜索帮助”退出程序调用一个操作。 如果输入帮助的进程流程,首先为这个事件调用搜索帮助退出,然后执行此事件一步被确定 如果在“搜索帮助”出口中确定了新的下一步,则此下一步将不再调用“搜索帮SAPBC_GLOBAL_F4_SFLIGHT Code: FUNCTION SAPBC_GLOBAL_F4_SFLIGHT. *\"---------------------------------------------------------------------- *\"*\"LokaleSchnittstelle: *\" TABLES *\" SHLP_TAB TYPE SHLP_DESCT *\" RECORD_TAB STRUCTURE SEAHLPRES *\" CHANGING *\" VALUE(SHLP) TYPE SHLP_DESCR *\" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL *\"---------------------------------------------------------------------- * The scope of this search help exit is decribed in the documentation. * Note that SAPBC_GLOBAL_F4_SFLIGHT_MIN_FR provides a more complex * example of a serch help exit. DATA: BEGIN OF Seatinfo OCCURS 0, \" parallel table to seatsmax TYPE SFLIGHT-SEATSMAX, \" record_tab containing seatsocc TYPE SFLIGHT-SEATSOCC, \" the information about seatsfre TYPE S_SEATSFRE, \" the seats END OF Seatinfo.

IF CALLCONTROL-STEP = 'SELECT'.

* The search help parameters SEATSMAX and SEATSOCC are not displayed on * the list of possible entries. Hence, provided they are not connected * to dynpro fields, the F4 processor might consider it not to be * necessary to select the contents of these fields.

* But this exit needs these contents in order to compute the number of * free seats. Thus, the space for this contents is allocated by the * following two calls. This automatically forces the F4 processor to * fill this space with the contents of these fields. CALL FUNCTION 'F4UT_PARAMETER_ALLOCATE' EXPORTING

PARAMETER = 'SEATSMAX' TABLES

SHLP_TAB = shlp_tab RECORD_TAB = record_tab CHANGING

SHLP = shlp

CALLCONTROL = callcontrol. CALL FUNCTION 'F4UT_PARAMETER_ALLOCATE' EXPORTING

PARAMETER = 'SEATSOCC' TABLES

SHLP_TAB = shlp_tab RECORD_TAB = record_tab CHANGING

SHLP = shlp

CALLCONTROL = callcontrol. ENDIF.

CHECK callcontrol-step = 'DISP'.

* This Exit only has to do something before the list of possible values * is displayed. At that moment it has to compute the number of free * seats for each row and attach it to the result of the selection * process

* First fill the seatsmax-Info from the selected data. Note that there * are two ways of using F4UT_PARAMETER_VALUE_GET described in the * documetation of that function module. Here the second one is used. CALL FUNCTION 'F4UT_PARAMETER_VALUE_GET' EXPORTING

PARAMETER = 'SEATSMAX'

\" Reference to search help parameter FIELDNAME = 'SEATSMAX'

\" Reference to field of Seatinfo

TABLES

SHLP_TAB = shlp_tab RECORD_TAB = record_tab RESULTS_TAB = Seatinfo CHANGING

SHLP = shlp

CALLCONTROL = callcontrol.

* Now do the same with the seatsocc-Info: CALL FUNCTION 'F4UT_PARAMETER_VALUE_GET' EXPORTING

PARAMETER = 'SEATSOCC'

\" Reference to search help parameter FIELDNAME = 'SEATSOCC'

\" Reference to field of Seatinfo TABLES

SHLP_TAB = shlp_tab RECORD_TAB = record_tab RESULTS_TAB = Seatinfo CHANGING

SHLP = shlp

CALLCONTROL = callcontrol.

* Now compute the number of free seats: LOOP AT Seatinfo.

IF Seatinfo-seatsoccSeatinfo-seatsfre = Seatinfo-seatsmax - Seatinfo-seatsocc. ELSE.

CLEAR Seatinfo-seatsfre. ENDIF.

MODIFY Seatinfo TRANSPORTING seatsfre. ENDLOOP.

* Finally transport the computed numbers into the search help data. CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT' EXPORTING

PARAMETER = 'SEATSFRE'

\" Reference to search help parameter FIELDNAME = 'SEATSFRE'

\" Reference to field of Seatinfo TABLES

SHLP_TAB = shlp_tab RECORD_TAB = record_tab SOURCE_TAB = Seatinfo CHANGING

SHLP = shlp

CALLCONTROL = callcontrol. ENDFUNCTION.

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- sceh.cn 版权所有 湘ICP备2023017654号-4

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务