In a previous tutorial, I showed you how to access helpvalues programmatically. Today, we will go one step further and add a filter for the helpvalue.
Filtering helpvalues can be useful in multiple cases. For example, some backend help values contain a large amount of entries. Just imagine a helpvalue that potentially accesses all vendors from your ECC. You might want to filter such a helpvalue for a specific company code to make the aBPM UI more user friendly. It could also be that your backend helpvalue expects some mandatory input parameters. In this tutorial, I will show you how to apply filters to your aBPM helpvalue implementations.
In my projects, I tend to use a helpvalue utility which typically provides static methods in a common component that can then be used by multiple scenarios.
The following excerpt from a method shows the usage of a helpvalue filter:
The helpvalue in question displays vendors and expects the company code as a mandatory input parameter. You see that I build a new Map<String,String> in line 64. This map will contain my input parameter. The key of this map contains the name of the parameter, the value contains the actual company code filter value. In line 65, I then set my filter by putting a new key-value-pair into the map. The variable “coco” contains the company code in question (note that this value is given as a parameter in the overall function). The thing you have to know about the helpvalue filters is how to specify the correct key for the parameter. In this example, the key is the string “CODELOW”. How did this come to play? Let’s look at the configuration of the helpvalue in the aBPM helpvalue administrator.
This picture shows the general configuration of the helpvalue in question:
On the filters tab, I configured a filter for the column “BUKRS” of the helpvalue:
Note that the name of my filter for the column “BUKRS” is called “CODE”. When you want to use a filter for helpvalues, you’ll have to specify whether it’s a low or a high filter. Typically, I see low filters in my projects when it comes to string values. Therefore, the key for my helpvalue parameter has to be “CODELOW” (for a high filter, it would be “CODEHIGH”). So the key contains the name of the parameter and whether it’s a low or high filter (low and high are meant for numeric filters…).
Let’s come back to the implementation of my method: in line 70, I use the HelpValueGet to retrieve the helpvalue-values. Note that I pass the parameter-map “params” in that call. I can then iterate through the returned object of type “HelpValueValuesDTO” (line 73) and access the columns of the helpvalue entry (lines 74-79). Those extracted values could for example be returned to the UI and displayed in a pretty Search Help dialog. How to implement such a dialog is extensively described in the aBPM cookbook (Chapter 4.1.6 “Search Helps”).