Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
katrin_welsch
Explorer
Search helps are widely used in aBPM UIs. But often end users complain about doing too much “clicking” for selecting a specific value.

We developed different solutions in our project making the use of search helps even more comfortable:

  • Use search help fields with manual inputs

  • Select a value and close the search help with one click


We use multiple user search helps in our scenario looking like the following example:





 

The respective BO defined within the aBPM excel sheet is shown below:



 

Use search help fields with manual inputs


Often power users are not willed to use search helps for inputs they already know exactly. Therefore, with aBPM it is also possible to use the search help for the support and validation of manual inputs.

This is shown exemplary with our user search helps.

Users always have two options:

  1. Open the search help directly over the button and search for the respective entry.

  2. Doing a manual field entry when the respective input is already known


For option two we use the Business Object of the search help provided by aBPM in the background without showing it to the user. This way we can execute the exact same search function behind the search help.

The onEnter event defined in the BO definition shown above will trigger the execution of the method shown below, which checks the manual input.

 
private void checkManualSearchUserInput(AbstractWrappedCallbackContext<Inbox> ctx) {
Inbox inbox = ctx.getWrappedBusinessObject();
CommonTextProviderLocal textProvider = new CommonTextProvider();
textProvider.initializeInboxResourceBundle(ctx.getLocale());
// If the search help fields is not empty
if (StringUtils.isNotBlank(inbox.getSubstitution_NewRule_User())) {
// First remove privious validation messages
removeOldValidationResult(ctx.getBusinessObject().getValidationResult(), InboxFieldsEnum.SUBSTITUTION_NEWRULE_USER.getName());

// Get the attribute of the search help fields
Attribute attr = ctx.getBusinessObject().getAttribute(InboxFieldsEnum.SUBSTITUTION_NEWRULE_USER.getName());

// Create a transient BO of the search help dialog (this is necessary since there is no actual search help opened within the UI)
if (attr.getChildBusinessObjects() == null || attr.getChildBusinessObjects().size() == 0) {
BusinessObjectMetaData bomd = attr.getAttributeMetaData().getBusinessObjectMetaData();
BusinessObjectMetaData childBOMD = bomd.getChildBusinessObjectMetaData(attr.getTechnicalName());
BusinessObject childBo;
try {
childBo = BORemoteControl.createChildBO(attr.getOwner(), childBOMD.getTechnicalName());
childBo.setLifecyleState(BusinessObjectLifecycle.TRANSIENT);
attr.getOwner().addBusinessObjectChild(childBo, attr.getTechnicalName());
} catch (BOMetaDataNotFoundException e) {
SimpleLogger.trace(Severity.ERROR, logger, "Error when creating child bo inside checkManualSearchUserInput()", e);
}
}

//The search help BO
Substitution_NewRule_User sh = new Substitution_NewRule_User(attr.getChildBusinessObjects().get(0));

// Separate first and last name from manual user input
String[] nameArray = StringUtils.splitByWholeSeparator(inbox.getSubstitution_NewRule_User(), " ");

String lastname = nameArray[nameArray.length - 1];
String firstname = "";

for (int i = 0; i < nameArray.length - 1; i++) {
firstname = firstname + " " + nameArray[i];
}

// Fill first and last name in search help BO
sh.setSubstitution_NewUser_FirstName(firstname);
sh.setSubstitution_NewUser_LastName(lastname);

// Execute user search
searchForUsers(ctx);

// Evaluate result
// If there are zero hits filled within the result table -> validation message
if (sh.getSubstitution_NewUser_Result().size() == 0) {
inbox.addValidationError(InboxFieldsEnum.SUBSTITUTION_NEWRULE_USER.getName(), textProvider.getInboxText(InboxText.INBOX_RULE_USERNOTFOUND));
// If there is more than one hit filled within the result table -> validation message, multiple user found
} else if (sh.getSubstitution_NewUser_Result().size() > 1) {
inbox.addValidationError(InboxFieldsEnum.SUBSTITUTION_NEWRULE_USER.getName(), textProvider.getInboxText(InboxText.INBOX_RULE_MULTIPLEUSERSFOUND));
// If there is exactly one hit filled within the result table -> distinct user could be found and will be used for further processing
} else {
User selectedUser = userProvider.getUserByUniqueName(sh.getSubstitution_NewUser_Result().get(0).getSubstitution_NewUser_ResultUser());
inbox.setSubstitution_NewRule_User(selectedUser.getFullname());
inbox.setSubstitution_NewRule_UserView(selectedUser.getLdapID());
}
}

}

 

Another helpful side effect of this implementation is that if the manual input did not result in a distinct search result, the user will see the multiple found results when opening the search help afterwards since the already existing BO will be used. Here he can make his selection then only by one click.

 

Select a value and close the search help with one click


By default with aBPM search helps the user selects a row of the result table and then confirms the selection by clicking the “OK” button of the dialog. To make this selection even simpler it is possible to implement that the search help is already closed when selecting an item.

Therefore, we defined an “onSelect” event for the result table BO within the excel sheet. When selecting a result item the event is cached within the handleUI() method. There one must do a custom implementation like the following code example.
if (InboxActionEnum.SELECT_USER.matches(event.getEventName())) {
// Initialize the result table BO with the selected BO in the event object
Substitution_NewUser_Result userBo = new Substitution_NewUser_Result(event.getSelectedBusinessObject());
// Set the result to your respective search help field
User selectedUser = userProvider.getUserByUniqueName(userBo.getSubstitution_NewUser_ResultUser());
inboxBo.setSubstitution_NewRule_User(selectedUser.getFullname());
inboxBo.setSubstitution_NewRule_UserView(userBo.getSubstitution_NewUser_ResultUser());
// Remove old validation messages
removeOldValidationResult(ctx.getBusinessObject().getValidationResult(), InboxFieldsEnum.SUBSTITUTION_NEWRULE_USER.getName());

// Close the search help dialog
SimpleOption op = new SimpleOption(null, true, null);
op.setCloseDialog(true);
return op;
}