Adding Search help to a Selection screen using Search help Object & function module 'F4IF_INT_TABLE_VALUE_REQUEST'
Using Search Help object
- Enter the transaction code as SE11 in the command field.
- Select the radio button for Search help and enter a name for the custom Search help. And click on Create button.
- On the next screen select the option 'Elementary search help'.
- Give some description for the search help.
- In the field Selection method, the database table name should be entered. This table is the one from which we are going to pick values for the field Infotype number. Table T582S can be used for this purpose.
- Select the dialog type :
A – Dialog depends on set of values. If there are more than 100 hits, a selection screen is displayed. Otherwise, the hit list is displayed immediately.
D - Display values immediately.
C – Dialog with value restriction. A selection screen is always displayed.
- In the Parameters structure below enter the fields required for selection criteria and displaying on value help.
- The various options on this section are:
IMP: Check this box to indicate that the field is an input field, that is, to be passed to the search help.
EXP: Check this box to indicate that the field is an output field, that is, to be passed from the search help to the screen.
LPOS: The position of the as it appears in the hit list.
SPOS: The position of the field as it appears in the selection screen.
SDIS: Causes the field to be “display only” in the selection screen.
Data element: Sets the attributes of the search help parameter. Normally filled in by the system.
MOD: Check this box to assign a different data element than the one supplied by the system.
Default value: Specify the default value in one of 3 ways: a ‘literal’(in quotes), a parameter
ID (ZRD), or a system field (SY-UNAME).
- You can provide a default value to the field used for selection. For e.g. here SPRSL is given the default value as SY_LANGU. This means whenever this search help is used for any Infotype Number field on screen, all the infotypes and there texts will be displayed in the system language. Likewise any selection criteria can be used.
- Once the Search Help is ready check it and activate it.
This newly created Search Help can be used in report program as below:
The statement MATCHCODE OBJECT can be used to assign a Search Help to a field.
The name of the search help is to be provided after this statement WITHOUT quotes.
Using the function module 'F4IF_INT_TABLE_VALUE_REQUEST'
- Along with the call to this Function module, following code should also be added:
- While calling the FM, we need to pass three itabs. These are as explained below:
Here the custom table used to supply input values for INFTY_NO is zhr_infty_f4.
Get the fields from table zhr_infty_f4 which will be displayed in the F4 help. Append these to table it_f4_fields.
In this example, two fields INFTY and INFTY_TEXT are displayed.
Provide the fieldname from custom table and screen field name to respective fields of table it_dselc
In this field (wa_retfield), the name of the screen field should be passed.
Select the entries to be added to the search help using a system table and store in it_f4_var , even custom table can be created for this purpose.
This function module can be used as below:
3. lv_retfield (type DFIES-FIELDNAME) is used to provide the structure of fields for Search help value display.
ld_f4_var is the internal table used to store input values. You can fill this table with required values providing n number of conditions in the select statement.
li_return (internal table of type ddshretval) used to store return parameter.
Read Here at SAP ABAP Forum to Get Answers for More Questions.
Advantages of Method 1 on Method 2 are
- You can adjust the structure of the Search Help display conveniently, keeping only the fields required and their position. If you want to do this in Method 2, you have to create a new custom table with required structure and provide it in RETFIELD.
- If you attach Search help to a data element or a table field, it will be useful for all report, programs, etc. wherever this data element or table field is used.
Advantage, of Method 2 on Method 1 is you can dynamically provide n number of conditions through the program and restrict the values accordingly. If you need to do this in method 1 you have to create different Search helps with different conditions.
Read Here for More SAP ABAP Tutorials