Skip to Content

In a few blogs that I will release in the course of the next weeks, I want to talk about some advanced techniques for the consulting solution aBPM (accelerated BPM). If you want to find out more, visit this page.

This situation is fairly common at customers, in fact I have implemented such methods at every customer I have had so far: You have a backend helpvalue from your ECC that contains certain values, e.g. a company code and a company code description. There might also be a few more values associated with one entry, for example, the company code’s country or currency. In those cases, you might have an aBPM backend helpvalue setup in the Helpvalue Administration. aBPM will create a value help with a key-value-pair in the UI almost automatically for you (compare the aBPM Cookbook if you have not done this before).

But in some cases, you might want to obtain a certain value directly and programmatically in your callback coding. A common example could be: the user opens the helpvalue for the company code and selects a value. The value is then automatically put into the corresponding UI field. But oftentimes, you’ll want to fill other fields in your UI with the just mentioned values such as company code names, countries, or currencies.

Meeting this requirement with aBPM is quite easy (works with both aBPM v2 and v3)! You just need one method that is called once the company code field changes (How to receive such a UI event is described in the aBPM Cookbook as well).

The implementation of this method is shown in the following figure (Please note that this particular method “getCompanyName” was realized in a common component and it was decided to implement it as a static method. This might not be the case for your particular project. Also having the BusinessObject as a parameter might be something you do not like for your project. You can also pass the required values, such as technical names, directly as string values if you like…).

/wp-content/uploads/2016/09/1_1046535.png

So how does this function work? In general, you see that you pass a company code value (e.g. “0204”) and a BusinessObject (I could also pass the technical name of the BusinessObject). Once the method is finished, the company code name (“companyName”) is returned as a single string value. In lines 106 and 107, I just create a new HelpValueGet-object that can retrieve the helpvalues

(CONTEXT_LOOKUP=”ejb:/interfaceName=com.sap.consulting.abpm.helpvalue.service.HelpValueGet”)

Most of the magic happens in line 109. In this line, I use this HelpValueGet to retrieve my helpvalue-values with the function “getHelpValues”. This function needs certain parameters: the name of the helpvalue from your Helpvalue Admin, the locale (e.g. “en_US”), optional parameters (in my case no parameters = “null”) and the technical name of the BusinessObject which we passed as a parameter to the getCompanyName-function. The resulting object of type HelpValueValuesDTO contains all the values from the helpvalue. Between lines 111 to 117, I iterate through these values to find the entry that I was looking for. Once I found the entry with the matching key (the key from the Helpvalue Admin, in our case “BUKRS”), I can get the value that I want in line 114 (in our example “BUTXT”). Note that I could also get multiple different values after line 114 and return them all. In this case, I just return a single string value or an empty string in case no value was found.

Please note that this example might not be the ideal implementation for your explicit scenario. The freedom that the aBPM callback methods offer to you also result in the sometimes difficult choice of how to actually implement things. But after reading through this and looking at the example, you should have an idea of how to retrieve helpvalues programmatically with a callback methods and find corresponding values from a helpvalue.

An obvious thing that could be made better in this function is that for larger helpvalues, you should use filter parameters in line 109 to not always get the complete helpvalue table. This might result in serious performance problems in case of larger helpvalue objects or much user activity in the system. But for the sake of an easy example, I did not cover filters in this tutorial. There will soon be another tutorial where I show you how to use helpvalue filters.

Happy coding and contact us in case of questions!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply