2008 May 12 2:39 PM
Hi friends
Can anyone explain me about Search-help Exit.
I don't have any idea about this, so please explain in detail with an example if possible.
Thanks
Suren
Hi friends
Can anyone explain me about Search-help Exit.
I don't have any idea about this, so please explain in detail with an example if possible.
Thanks
Suren
2008 May 12 2:42 PM
Hi,
Calling the Search Help Exit
If a search help exit is assigned to a search help, the help processor calls it at the following times:
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 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.
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.
Regards,
Kumar.
2008 May 12 4:54 PM
hi,
[http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm]
assign points if helpful
Thanks
Prashanth
2008 May 12 5:52 PM
A search help exit is a function module that has a predefined interface. A search help exit is called at certain times by the help processor. The administrative data of the help processor are passed to the search help exit using the interface.
You can store your own program logic that manipulates this administrative data in the search help exit. Individual steps of the input help process can be skipped with a search help exit.
CHk this.
www.sapnet.ru/docs/search_helps.ppt
AlsoChk this SAP help document..
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21ee52446011d189700000e8322d00/content.htm
2008 May 13 6:07 AM
Hi Surendranath,
A search help exit is a function module for making the input help process described by the search help more flexible than possible with the standard version.
This function module must have the same interface as function module F4IF_SHLP_EXIT_EXAMPLE. The search help exit may also have further optional parameters (in particular any EXPORTING parameters).
A search help exit is called at certain timepoints in the input help process.
Note: The source text and long documentation of the above-specified function module (including the long documentation about the parameters) contain information about using search help exits.
Function modules are provided in the function library for operations that are frequently executed in search help exits. The names of these function modules begin with the prefix F4UT_. These function modules can either be used directly as search help exits or used within other search help exits. You can find precise instructions for use in the long documentation for the corresponding function module.
During the input help process, a number of timepoints are defined that each define the beginning of an important operation of the input help process.
If the input help process is defined with a search help having a search help exit, this search help exit is called at each of these timepoints. If required, the search help exit can also influence the process and even determine that the process should be continued at a different timepoint.
timepoints
The following timepoints are defined:
1. SELONE
Call before selecting an elementary search help. The possible elementary search helps are already in SHLP_TAB. This timepoint can be used in a search help exit of a collective search help to restrict the selection possibilities for the elementary search helps.
Entries that are deleted from SHLP_TAB in this step are not offered in the elementary search help selection. If there is only one entry remaining in SHLP_TAB, the dialog box for selecting elementary search helps is skipped. You may not change the next timepoint.
The timepoint is not accessed again if another elementary search help is to be selected during the dialog.
2. PRESEL1
After selecting an elementary search help. Table INTERFACE has not yet been copied to table SELOPT at this timepoint in the definition of the search help (type SHLP_DESCR_T). This means that you can still influence the attachment of the search help to the screen here. (Table INTERFACE contains the information about how the search help parameters are related to the screen fields).
3. PRESEL
Before sending the dialog box for restricting values. This timepoint is suitable for predefining the value restriction or for completely suppressing or copying the dialog.
4. SELECT
Before selecting the values. If you do not want the default selection, you should copy this timepoint with a search help exit. DISP should be set as the next timepoint.
5. DISP
Before displaying the hit list. This timepoint is suitable for restricting the values to be displayed, e.g. depending on authorizations.
6. RETURN (usually as return value for the next timepoint)
The RETURN timepoint should be returned as the next step if a single hit was selected in a search help exit.
It can make sense to change the F4 flow at this timepoint if control of the process sequence of the Transaction should depend on the selected value (typical example: setting SET/GET parameters). However, you should note that the process will then depend on whether a value was entered manually or with an input help.
7. RETTOP
You only go to this timepoint if the input help is controlled by a collective search help. It directly follows the timepoint RETURN. The search help exit of the collective search help, however, is called at timepoint RETTOP.
8. EXIT (only for return as next timepoint)
The EXIT timepoint should be returned as the next step if the user had the opportunity to terminate the dialog within the search help exit.
9. CREATE
The CREATE timepoint is only accessed if the user selects the function "Create new values". This function is only available if field CUSTTAB of the control string CALLCONTROL was given a value not equal to SPACE earlier on.
The name of the (customizing) table to be maintained is normally entered there. The next step returned after CREATE should be SELECT so that the newly entered value can be selected and then displayed.
10. APP1, APP2, APP3
If further pushbuttons are introduced in the hit list with function module F4UT_LIST_EXIT, these timepoints are introduced. They are accessed when the user presses the corresponding pushbutton.
Note: If the F4 help is controlled by a collective search help, the search help exit of the collective search help is called at timepoints SELONE and RETTOP. (RETTOP only if the user selects a value.) At all other timepoints the search help exit of the selected elementary search help is called.
If the F4 help is controlled by an elementary search help, timepoint RETTOP is not executed. The search help exit of the elementary search help is called at timepoint SELONE
F4IF_SHLP_EXIT_EXAMPLE
This module has been created as an example for the interface and design of Search help exits in Search help.
All the interface parameters defined here are mandatory for a function module to be used as a search help exit, because the calling program does not know which parameters are actually used internally.
A search help exit is called repeatedly in connection with several
events during the F4 process. The relevant step of the process is passed on in the CALLCONTROL step. If the module is intended to perform only a few modifications before the step, CALLCONTROL-STEP should remain unchanged.
However, if the step is performed completely by the module, the following step must be returned in CALLCONTROL-STEP.
For more detailed information please refer to the documentation describing the concept of the search help exit.
The module must react with an immediate EXIT to all steps that it does not know or does not want to handle.
Example:
Enhancing a Standard Search Help
Step 1 - Create a custom Function Group in SE37 called ZSHLP
Step 2 -
1)In order to create a search help enhancement function, we need the interface parameters of function module F4IF_SHLP_EXIT_EXAMPLE (of Function Group SDHI).
2)Create a function module Z_CUSTOM_SEARCH within our custom function group ZSHLP
3) We need to create a similar set of parameters within Z_CUSTOM_SEARCH, as exists in F4IF_SHLP_EXIT_EXAMPLE.
Step 3
1) Within Function Module Z_CUSTOM_SEARCH go to Main Program as shown in Figure 7 and in the main program TOP include, in this case INCLUDE LZSHLPTOP insert the following line
type-pools shlp.
2) Save and activate the function module. You have the search help enhancement function framework ready
Step 4
1) Go to SE11 create a custom elementary search help called ZXXXX
2) Assign the fields that you want to display on the selection condition as well as on the hit list.LPos is the Hit-list position and SPos is the order of the fields on the search help selection screen.
3) Hit list fields in the ascending order of LPos values: (For Example)
1 - Ship To Customer Number - KUNNR (Make sure this is an export field as this is what we want to put back on the Ship-to or Sold-to party fields after the user double clicks on a value on the hit list)
2 - Ship to Customer Name NAME1
3 - City ORT01
4 - Street STRAS
5 - Bill to Customer Number KUNN2
4) The SPos position dictates the order in which the restriction fields will appear on the selection screen in the search help tab. In the ascending order of SPos values:
1 - Account group - KTOKD
2 - Search term - SORTL
3 - Name MCOD1
4 - City ORT01
5 - Customer Number - KUNNR
5) Assign the custom function module Z_CUSTOM_SEARCH as Search help exit. We are not using any Selection method for this, since our selection is being done within the function module.
6) Since we want to restrict values , we set the Dialog Type to Dialog with value restriction and any Hot key as desired.
Step 5
1) Go to SE11 to Search help <Search help name> and hit Display button
2) Go to Included search helps tab and hit Goto-> Append search help
3) You will be prompted to append the <Search help name> search help with a proposed name <ZASearch help name> as shown below.
4) Enter
5) Go to the Included search helps tab of <ZASearch help name>I. Here is where you will attach the custom search help ZXXXX created in Step 4. Select ZS_BILLTO and do the Parameter assignment for the value to be transferred to the screen.Set this to KUNNR for example(set as per your requirement), to be pulled from the hit list to the screen field when the user double clicks on a certain line.
Step 6 If you read the standard SAP help for the enhancement as shown in the link below, it mentions how each of the events come into play. http://help.sap.com/saphelp46c/helpdata/EN/cf/21ee2b446011d189700000e8322d00/frameset.htm_
Calling the Search Help Exit
If a search help exit is assigned to a search help, the help processor calls it at the following times:
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 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.
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.
We are writing our code in the event of Before Selecting Data when callcontrol-step = SELECT. If you wanted to further restrict the data in the hit list, you could filter it when callcontrol-step = DISP.
Step 7 Within Function Module Z_CUSTOM_SEARCH put in the custom code for retrieving data within the SELECT scenario of CALLCONTROL-STEP as shown in source code below. Make sure to set the next event as CALLCONTROL-STEP = DISP within the code.
Code Sample
-
BEGIN OF CODE SAMPLE
-
-
BEGIN OF INCLUDE LZSHLPTOP
-
FUNCTION-POOL zshlp. "MESSAGE-ID ..
TYPE-POOLS shlp.
TYPES:
BEGIN OF t_knvp,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
ort01 TYPE ort01_gp,
stras TYPE stras_gp,
kunn2 TYPE knvp-kunn2,
name1_2 TYPE kna1-name1,
END OF t_knvp.
DATA: i_knvp TYPE TABLE OF t_knvp,
wa_knvp TYPE t_knvp,
wa_selopt TYPE ddshselopt,
wa_fielddescr TYPE dfies.
DATA:
rc TYPE i,
v_tabix LIKE sy-tabix.
RANGES: r_ktokd FOR kna1-ktokd,
r_mcod1 FOR kna1-name1,
r_sortl FOR kna1-sortl,
r_kunnr FOR kna1-kunnr,
r_ort01 FOR kna1-ort01.
-
END OF INCLUDE LZSHLPTOP
-
-
BEGIN OF FUNCTION MODULE Z_CUSTOM_SEARCH
-
FUNCTION z_custom_search.
*"----
""Local interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCR_TAB_T
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" VALUE(SHLP) TYPE SHLP_DESCR_T
*" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
*"----
EXIT immediately, if you do not want to handle this step
CASE callcontrol-step.
*"----
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.
WHEN 'SELECT'.
Change column header texts appearing on the search help hit list
LOOP AT shlp-fielddescr INTO wa_fielddescr.
v_tabix = sy-tabix.
CASE wa_fielddescr-fieldname.
WHEN 'KUNNR'.
wa_fielddescr-fieldtext = 'ShipToCustomer#'.
wa_fielddescr-reptext = 'ShipToCustomer#'.
wa_fielddescr-scrtext_s = 'ShipTo #'.
wa_fielddescr-scrtext_m = 'ShipToCustomer#'.
wa_fielddescr-scrtext_l = 'ShipToCustomer#'.
MODIFY shlp-fielddescr FROM wa_fielddescr
INDEX v_tabix TRANSPORTING fieldtext reptext scrtext_s
scrtext_m scrtext_l.
WHEN 'KUNN2'.
wa_fielddescr-reptext = 'BillToCustomer#'.
wa_fielddescr-fieldtext = 'BillToCustomer#'.
wa_fielddescr-scrtext_s = 'BillTo #'.
wa_fielddescr-scrtext_m = 'BillToCustomer #'.
wa_fielddescr-scrtext_l = 'BillToCustomer #'.
MODIFY shlp-fielddescr FROM wa_fielddescr
INDEX v_tabix TRANSPORTING fieldtext reptext scrtext_s
scrtext_m scrtext_l.
WHEN 'NAME1'.
wa_fielddescr-fieldtext = 'ShipToCustomer Name'.
wa_fielddescr-reptext = 'ShipToCustomer Name'.
wa_fielddescr-scrtext_s = 'ShipTo Name'.
wa_fielddescr-scrtext_m = 'ShipToCustomer Name'.
wa_fielddescr-scrtext_l = 'ShipToCustomer Name'.
MODIFY shlp-fielddescr FROM wa_fielddescr
INDEX v_tabix TRANSPORTING fieldtext reptext scrtext_s
scrtext_m scrtext_l.
ENDCASE.
ENDLOOP.
Select the Bill to party customer based on the select options
FREE: r_ktokd, r_kunnr, r_sortl, r_mcod1, r_ort01, i_knvp.
LOOP AT shlp-selopt INTO wa_selopt.
Build a Range for the 5 selection options of the search help
CASE wa_selopt-shlpfield.
WHEN 'KTOKD'.
r_ktokd-sign = wa_selopt-sign.
r_ktokd-option = wa_selopt-option.
r_ktokd-low = wa_selopt-low.
r_ktokd-high = wa_selopt-high.
APPEND r_ktokd.
CLEAR r_ktokd.
WHEN 'KUNNR'.
r_kunnr-sign = wa_selopt-sign.
r_kunnr-option = wa_selopt-option.
r_kunnr-low = wa_selopt-low.
r_kunnr-high = wa_selopt-high.
APPEND r_kunnr.
CLEAR r_kunnr.
WHEN 'SORTL'.
r_sortl-sign = wa_selopt-sign.
r_sortl-option = wa_selopt-option.
r_sortl-low = wa_selopt-low.
r_sortl-high = wa_selopt-high.
APPEND r_sortl.
CLEAR r_sortl.
WHEN 'MCOD1'.
r_mcod1-sign = wa_selopt-sign.
r_mcod1-option = wa_selopt-option.
r_mcod1-low = wa_selopt-low.
r_mcod1-high = wa_selopt-high.
APPEND r_mcod1.
CLEAR r_mcod1.
WHEN 'ORT01'.
r_ort01-sign = wa_selopt-sign.
r_ort01-option = wa_selopt-option.
r_ort01-low = wa_selopt-low.
r_ort01-high = wa_selopt-high.
APPEND r_ort01.
CLEAR r_ort01.
ENDCASE.
ENDLOOP.
Retrieve data from KNVP table for the above selected ranges
Doing query to retrieve data for the search help
SELECT knvp~kunnr
kna1~name1
kna1~ort01
kna1~stras
knvp~kunn2
INTO TABLE i_knvp
FROM knvp
INNER JOIN kna1
ON knvpkunnr = kna1kunnr
WHERE
knvp~parvw = 'RE' AND " Bill to Party
knvp~kunnr IN r_kunnr AND
kna1~ktokd IN r_ktokd AND
kna1~sortl IN r_sortl AND
kna1~mcod1 IN r_mcod1 AND
kna1~ort01 IN r_ort01.
CHECK sy-subrc = 0.
DELETE ADJACENT DUPLICATES FROM i_knvp.
Select the short text for kunn2 from kna1.
Move all the selected records to Record_Tab
LOOP AT i_knvp INTO wa_knvp.
v_tabix = sy-tabix.
SELECT SINGLE name1 FROM kna1
INTO wa_knvp-name1_2
WHERE kunnr = wa_knvp-kunnr.
MOVE wa_knvp TO record_tab-string.
APPEND record_tab.
CLEAR record_tab.
MODIFY i_knvp FROM wa_knvp INDEX v_tabix.
CLEAR wa_knvp.
ENDLOOP.
rc = 0.
IF rc = 0.
callcontrol-step = 'DISP'.
ELSE.
callcontrol-step = 'EXIT'.
ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
WHEN 'PRESEL1'.
WHEN 'DISP'.
WHEN OTHERS.
ENDCASE.
ENDFUNCTION.
-
END OF FUNCTION MODULE Z_CUSTOM_SEARCH
-
-
END OF CODE SAMPLE
-
Save and activate at every step.
Output Result
After doing all of the above steps, its time to see the output! Go to transaction(your desired transaction), enter the required details and hit Enter to go to the second screen. Place cursor on the required field and hit F4.
Regards,
Naresh
****If found useful please do reward points.
2008 May 13 6:35 AM
2008 May 16 11:46 AM
hi,
A search help describes the standard input help process. In exceptions it could be necessary to deviate in some points from this standard. Such a deviation from the standard can also be implemented with a search help exit.
The input help process should look as much the same as possible throughout the entire system. Search help exits should therefore only be used for exceptions.
A search help exit is a function module that has a predefined interface. A search help exit is called at certain times by the help processor. The administrative data of the help processor are passed to the search help exit using the interface.
You can store your own program logic that manipulates this administrative data in the search help exit. Individual steps of the input help process can be skipped with a search help exit.
Search help exit F4UT_OPTIMIZE_COLWIDTH adjusts the column width in the hit list to the contents of the column. It makes sense to use this search help exit when the columns of the hit list have to be made very wide for extreme cases (e.g. for name fields), but normally they will contain much smaller values.
Each search help exit must have the same interface as function module F4IF_SHLP_EXIT_EXAMPLE (is used as pattern for all the search help exits to be created). You can find more information about the interface in the documentation for this function module.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |