2007 Oct 05 11:56 AM
Hi Experts,
i want to create a search help for my selection screen field, could anyone give me a step by step procedure.
Thanks in advance,
sudharsan.
Hi Experts,
i want to create a search help for my selection screen field, could anyone give me a step by step procedure.
Thanks in advance,
sudharsan.
2007 Oct 05 11:58 AM
Hi
1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
3)An elementary search help defines the standard flow of an input help.
4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
CREATION:
Go to SE11 Tcode
select search help
give the 'z' search help name and create
select the selection method ur table name eg : 'mara'
dialog module 'display value immediately'.
add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
where left position when displaying and spos = search position
and then save and activate ..
See the links:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
pls go through this for search help creation
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
Search Help Exits:
***************************
collective search help creation
https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=2176485
https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=3601619
***************************
Regards
Vasu
2007 Oct 05 12:02 PM
Hello Sudharsan,
Goto to SE11. Enter name starting with Z in the search help. Press Create button. I will tell u for the simple search help but there are collective search helps also where u can combine more than one simple search helps.
Back to simple search helps...
Enter the table name Selection method. Slect fields which u want to display in the search help in the parameter.Activate the search and it is ready to use.
2007 Oct 05 12:05 PM
Hi,
go to SE11,
select search help radio-button....create
Then select whether to create elementary or collective search help.
Then after that in 'selection criteria' give table name in which the field exists ( Field for which u want to create search help.)..
In search help parameter give the field name for which u need to create search help.
save an activate.
Message was edited by:
Dhananjay Patil
2007 Oct 05 12:47 PM
Hi,
When a standard SAP search help needs to be enhanced, the steps involved are:
a) Creating a custom search help and attaching a table or view as a Selection method in the Definition tab
c) Including the custom search help to the standard search help
However, when the data to be shown in the search help is complex and cannot be achieved by simply
creating a view in SE11, we need to develop a custom function module with the data retrieval logic and attach
it to our custom search help as Search help exit in the Definition tab. This document explains how to go
about doing this.
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com
Procedure
3) You will be prompted to append the SD_DEBI search help with a proposed name ZASD_DEBI as shown
below.
9
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com
4) Hit
5) Go to the Included search helps tab of ZASD_DEBI. Here is where you will attach the custom search help
ZS_BILLTO created in Step 4. Select ZS_BILLTO and do the Parameter assignment for the value to be
transferred to the screen. We have set this to KUNNR for our example, to be pulled from the hit list to the
screen field when the user double clicks on a certain line.
10
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 11
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/saphelp_46c/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 ..
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 12
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.
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 13
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.
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 14
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.
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 15
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.
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com
Output Result
1) After doing all of the above steps, its time to see the output! Go to transaction VA01, enter details like
Order Type and hit Enter to go to the second screen. Place cursor on the Ship-to party field at the header
section and hit F4. The last tab shows our custom search help Custom Bill To Search.
16
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com
2) Enter restriction values and hit enter to see the hit list result
3) Double clicking on any line, will bring back the value to the screen as seen below:
17
Enhancing a Standard Search Help
© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com
Conclusion
From the above example, we are able to filter based on the selection fields, change the column headers text
appearing on the hit list and content of internal table RECORD_TAB, the contents of which are shown on the
hit list. As you can see, the search help exit is a powerful feature that greatly enhances the whole search help
functionality and makes life easier for business. You can do this for any standard SAP search help which will
reflect across all transactions which use that search help, thus making it global.
Reward if useful.
2007 Oct 05 1:03 PM
Hi Sudharsan,
Here are the steps for creating an elementary search help :
Creation of Elementary Search Help:
The creation of an elementary search help is described below with example.
1. Open TCode SE11 for DDIC objects -> select the radio button for Search helps -> give the name of the search help you want to create, ex ZSH004.Click on Create .
2. In the next screen select the option Elementary search help .
3. Now you need to provide the short text for your search help.
4. In the selection method provide the table or view name you want to use for data retrieval. Ex. ZMARA_01.
5. Select the dialog type according to your scope, ex. display values immediately.
6. Then provide the search help parameters i.e. the interface parameters for the search help .
7. The ZMARA_01 table fields MATNR, ERSDA,MHDHB,MHDHT,MHDRZ are provided by selecting the table fields , by doing this the data elements for these fields are automatically copied to the interface from the selection method.
8. Now define the type of parameter ( import or export ) here for the selection and return of values in runtime.
9. Provide the positions to these parameters to specify how they will be arranged in the hit list display.
10. Now save the object in the respective development class and check the same for errors and then activate .Finally the creation of a ESH ( ex: ZSH004 ) is complete and can be used for providing the input help.
You can test the operation of your search help by clicking F8.
The appearance of your search help will be like the fig. provided below.
Hope u'll be able to do it ..
Reward if helpful !
Regards,
Hemant
2007 Nov 17 4:06 PM
any idea how further you may restrict or use search helps user/login wise....
2007 Nov 17 4:15 PM
Hi KK,
Write Search help exit to restrict to particular user.
Search Help Exits:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/content.htm
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_exit.htm
https://forums.sdn.sap.com/click.jspa?searchID=4390517&messageID=1712818
Reward if this helps,
Satish
2007 Nov 17 5:24 PM
u can try
f4if_int_table_value_requst.
u can use this func. module.
2007 Nov 17 6:08 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |