About search help exit and sample collections (from Jack Wu)

Source: Internet
Author: User

1. Search Help exit is used to expand the standard help to provide better flexibility.

2. When is search help exit called?

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 inHot KeyOf the Elementary Search HelpImmediate value displayIs 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 inHot KeyOf the Elementary Search HelpImmediate value displayIs 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 cocould be advisable to intervene at this time if control of the further transaction flow shocould depend on the value selected. A typical example is setting set/get parameters.

3. Search Help exit function template (f4if_shlp_exit_example)ProgramYou can copy this function to adapt it to your enterprise applications.

type-pools SHlP.
type-pools f4typ. "BR ücke zu Alten F4-Bausteinen
tables: ddshdefsh. "tabelle der default-suchhilfen
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
* 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
* 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 shocould change CALLCONTROL-STEP
* To 'select '.
* Normaly only SHLP-SELOPT shocould 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 shocould 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
* Shocould 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
* This line are entered into the screen.
*-"Exit" if the values request shocould 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. ExampleCode(Refer to sap instance sflight)
Search Help exit sapbc_global_f4_sflight is set in sflight (SE11. The Code is as follows:

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
*" Scope
* 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
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
* Free seats. Thus, the space for this contents is allocated by
* Following Two cballs. This automatically forces the F4 processor
* 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
* Specified etation 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.
Specific Process

Http://blog.csdn.net/CompassButton/archive/2007/01/24/1492229.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.