SAP Screen Personas
Create: Tobias Queck Sep 25, 2014 05:03
Last Update: Regina Sheynblat Feb 05, 2019 23:59
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. At the moment, Personas supports only generic search helps based on database tables.
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 needs to be whitelisted.
Adding a search help to a text field implicitly allows the user to search through the database table 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) using your preferred SAP GUI. To get to the F4 Help Whitelist maintenance, use the menu path Goto -> Whitelists -> F4 Help Whitelist. It opens the following screen:
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 referenced search helps of the specified table fields. Last but not least, you can limit the usage of the tables 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 SAP GUI for HTML 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 a value is selected.
3, If the drop down list with table names is empty, then please go back to the preparation step
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
2. Select the input field
- 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
4. Enter the table that is to be shown and the field that is to be returned, e.g.:
This method opens the F4 help defined by the parameters 'table' and 'field'. Parameters 'table' and 'field' define the F4 help to be opened. 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.
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 has been introduced in the Admin transaction by Personas 3.0 SP02. It is accessed via Goto -> Whitelists -> Create Help INCLUDE.
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 F4 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.
While this feature was introduced with SP02, it is possible to achieve the same result in earlier Personas 3.0 releases by creating a Z structure in the Data Dictionary and follow the above steps, then use this structure in the whitelist.
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.
SAP Screen Personas, Scripting, Search Help, F4