SAP Screen Personas
Create: Tobias Queck
Last Update: Tamas Hoznek
Using Search Helps
SAP SCREEN PERSONAS KNOWLEDGE BASE - by Tobias Queck , Tamas Hoznek , Regina Sheynblat
This article describes the steps required to add a search help (a.k.a. F4 help) to a text field. Personas supports only generic search helps based on database tables, defined in the Data Dictionary.
In SAP Screen Personas 3.0, you can add search helps to existing or new input fields. There are different options to add either simple helps or more sophisticated scripts. In addition, before a search help can be added, the table it can access must be whitelisted.
Adding a search help to a text field implicitly allows the user to search through the database table(s) the screen field is connected to, or any information that the referenced search help can access. Therefore, please consider carefully where to add F4 helps and use authorization checks when necessary, as described below.
Before you start assigning F4 helps, all tables that can be used need to be whitelisted via the SAP Screen Personas Administration (transaction /PERSONAS/ADMIN). To get to the Search Help Whitelist maintenance, navigate to Whitelists → Search Helps. You can also start transaction /PERSONAS/F4_HELP. The following screen will open:
In this view, you can define the tables that are accessible as well as the fields that are allowed to be returned. The F4 Help function will use the search helps of the specified table- or structure fields. Last but not least, you can limit the usage of the search help to users that have specific authorizations. In this example screenshot, all fields for table SUID_ST_BNAME are enabled without any specific authorization requirements. If sensitive data is displayed by the search help results, the appropriate authorization object, field and activity should be specified to prevent unauthorized access.
Create a flavor
After the preparation is done, you need to start your flavor editor and create a flavor (or edit an existing flavor) to assign a search help. This is possible with two different options.
Option 1 - Add a new input field
If you want to add a new input field to a flavor that has a search help attached, follow the steps below:
1. Once in edit mode, go to the Insert tab and select Text field -> F4 Help
2. In the dialog that opens, select the table that is to be searched and define the field/column that is to be returned when the user selects a value from the search help result list.
3, If the drop down list with table names or field name is empty, then please go back to the preparation step to correct the whitelist
Option 2 - Assign a script to the onF4 event
If you have an existing flavor with an existing input field - this could be one from the original screen or a newly added input field - and you want to assign a script that is triggered if a user focuses the field and presses F4, then follow these steps.
1. Open the scripting mode and create a new script
- Click on the script inspector icon
- Click on the input field
- Wait until the list of all available properties and methods is shown underneath the id of the field
3. Click on showF4Help and code like below should be generated:
session.findById("wnd/usr/txtPersonas_2").showF4Help(String table, String field,Value);
This method opens the search help defined by the parameters 'table' and 'field'. These parameters are mandatory. The parameter 'value' specifies the initial value of the F4 help. If it is not provided , then the current value of the text property is taken instead.
4. Specify the table that is to be shown and the field that is to be returned, e.g.:
5. Save the script and leave the script editor
6. Open the flavor editor and bind the script to the onF4 event
Handling situations without suitable search help references
In some cases we may find that a particular search help is not tied to any database- or structure field. In other words, a suitable search help does exist but there is no direct link specified via the Data Dictionary which would make it available for the Personas F4 Help whitelist. This can happen if the search help is assigned to the screen field as a property via the Screen Painter.
Another problematic scenario is if there is a search help assignment, but the search help is realized using a check table. In such cases, the resulting possible value list is a rather poor-looking simple display of keys. Such an example would be the production order number (AUFNR) in structure CAUFVD. If we whitelist table CAUFVD and field AUFNR, hitting F4 gives the following list:
At the same time, in transaction CO03 where the same table and field reference is used, the search help looks like:
If we want to provide the above search help without finding a suitable DDIC reference, we can use a feature which is accessed via the "Maintain Help INCLUDE" button in the search help whitelist.
This function maintains a standard structure CI_PERSONAS_SHLP and here we have the possibility to enter a new field name and assign the desired search help, thereby providing the necessary table and field name the Search Help Whitelist needs:
The structure CI_PERSONAS_SHLP is actually part of the structure /PERSONAS/SEARCHHELP and allows maintenance of this custom search help structure without having to register the object for modification. Table name /PERSONAS/SEARCHHELP and the field PRODORD can now be whitelisted:
Referencing this entry when creating a new input field will activate search help CO_SH_PRODORD_ALL, just like in transaction CO03. The structure CI_PERSONAS_SHLP can certainly be enhanced with new search help references as necessary.
This article showed two alternatives allowing to add search helps to text fields. Option 1 is the usual standard approach and should be used for simple scenarios when a new field is to be added. Option 2 on the other hand, can be used with existing fields as well as if a custom logic needs to be executed before the F4 help is opened.
Related Search Terms:
SAP Screen Personas, Scripting, Search Help, F4
SAP Screen Personas 3.0 Scripting Guide