Chinaunix首页 | 论坛 | 博客
  • 博客访问: 710436
  • 博文数量: 145
  • 博客积分: 3446
  • 博客等级: 中校
  • 技术积分: 1567
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-30 13:58
文章分类

全部博文(145)

文章存档

2021年(1)

2020年(1)

2019年(1)

2018年(6)

2017年(1)

2016年(10)

2015年(12)

2014年(10)

2013年(15)

2012年(33)

2011年(21)

2010年(9)

2009年(18)

2008年(2)

2006年(5)

我的朋友

分类: 项目管理

2012-04-18 15:34:18

1、 search help Exit是用于对标准帮助进行扩充,以提供更好的灵活性。
??
??2、search help Exit何时被调用
??
??Before Displaying the Dialog Box for Selecting the Required Search Path.
??
??It is only called for collective search helps. Using the search help exit, the set of elementary search helps available can for example be restricted depending on the context.
??
??Before Starting the F4 Process for the Elementary Search Help
??
??The call is triggered independent of whether the dialog window for entering the search conditions appears or whether the selection is executed immediately (for example, because in the Hot key of the elementary search help Immediate value display is set).
??
??Before Displaying the Dialog Box for Entering Search Conditions.
??
??You can either influence the dialog for entering search conditions or skip it altogether here. You can also influence how the selection screen looks. The call is triggered only if there is no direct selection (that is, if in the Hot key of the elementary search help Immediate value display is not set).
??
??Before Selecting Data.
??
??The data selection can be partly or completely copied from the search help exit. This can become necessary if the data selection cannot be implemented with a SELECT statement for a table or a view.
??
??Before Displaying the Hit List.
??
??You can influence the display of the hit list in this step with the search help exit. You can reduce the number of values displayed here. For example, you can display only values for which the person calling the input help has authorization. You can also copy the complete hit list from the search help exit.
??
??Before Returning the Values Selected by the User to the Input Template.
??
??It could be advisable to intervene at this time if control of the further transaction flow should depend on the value selected. A typical example is setting set/get parameters.
??
??3、search help Exit的函数模板(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.
?? exit.
?? endif.
??endfunction.
??
??4、样例代码(参考sap的实例SFLIGHT)
??SFLIGHT(SE11)中设置了search help exit SAPBC_GLOBAL_F4_SFLIGHT 。代码如下:
??
??function sapbc_global_f4_sflight.
??*"----------------------------------------------------------------------
??*"*"Lokale Schnittstelle:
??*" 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-seatsocc < seatinfo-seatsmax.
?? seatinfo-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.
  SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L1S31 { font-style: italic; color: #808080; } .L1S32 { color: #3399FF; } .L1S33 { color: #4DA619; } .L1S52 { color: #0000FF; } FUNCTION zf_sh11_002.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      SHLP_TAB TYPE  SHLP_DESCR_TAB_T
*"      RECORD_TAB STRUCTURE  SEAHLPRES
*"  CHANGING
*"     REFERENCE(SHLP) TYPE  SHLP_DESCR_T
*"     REFERENCE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
*"----------------------------------------------------------------------

  DATA:   ls_result   TYPE zst_statu,
          lt_result   LIKE TABLE OF ls_result.

  DATA:ls_selpot LIKE ddshselopt.
  FIELD-SYMBOLS:  TYPE ddshselopt.

  DATA lv_process_type TYPE crmt_process_type .
  DATA lv_catgory TYPE ze_catgory .
  DATA lv_itm_type TYPE ze_itm_type .
  DATA lv_stsma   TYPE j_stsma .

******************************************************************************

  CLEAR: lv_catgory,lv_process_type ,lv_stsma,lv_itm_type.

  CHECK callcontrol-step = 'DISP'.

  LOOP AT shlp-selopt ASSIGNING .
    CASE -shlpfield.
      WHEN 'PROCESS_TYPE'.
        lv_process_type = -low .
      WHEN 'CATGORY'.
        lv_catgory = -low .
      WHEN 'ITM_TYPE'.
        lv_itm_type = -low .
    ENDCASE.
  ENDLOOP.

  IF lv_catgory = 'H'.

    SELECT SINGLE user_stat_proc
      INTO lv_stsma
      FROM crmc_proc_type
      WHERE process_type = lv_process_type .

  ELSEIF lv_catgory = 'I'.

    SELECT SINGLE user_stat_proc
      INTO lv_stsma
      FROM crmc_item_type
      WHERE itm_type = lv_itm_type .

  ENDIF.

  SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_result
    FROM tj30t
    WHERE stsma = lv_stsma
      AND spras = sy-langu .

  CALL FUNCTION 'F4UT_RESULTS_MAP'
    TABLES
      shlp_tab          = shlp_tab
      record_tab        = record_tab
      source_tab        = lt_result
    CHANGING
      shlp              = shlp
      callcontrol       = callcontrol
    EXCEPTIONS
      illegal_structure = 1
      OTHERS            = 99.


ENDFUNCTION.
阅读(960) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~