SAP S/4HANA Key User Extensibility: Custom field with context-dependent value help
Do you want to know how you can enhance the usability of a key user custom field of type “Value Help based on CDS View” by utilizing the new feature “Value Help Binding”?
If your answer is yes, then this blog post is just for you.
With this document, we’ll explain the following topic:
- How to configure your custom field of type “Value Help based on CDS View” in a way that its value help is context-dependent by additional filter values supplied by instance data
Let’s assume we already created a key user custom field “Approver(Demo)” of type “Value Help based on CDS View” on the “Procurement: Purchasing Document” business context and we already made it visible in the purchase order header section of the “Manage Purchase Orders” Fiori app. How to develop such a custom field using the power of Embedded Steampunk can be taken from the blog “SAP S/4HANA Key User Extensibility powered by Embedded Steampunk: Custom Field with ABAP implemented Value Help“ blogpost .
Let‘s also assume that we created another custom field of type “Association to Business Object”on the “Procurement: Purchasing Document” business context associating the “Company Code” business object. The value of this field will later on act as context for the value help of the custom field “Approver(Demo)”.
Note that the standard field “Company Code” already exists, and that the standard field “Approver” in the purchase order business object already exists. Let’s assume that we handle our approval process a bit differently than usual and therefore introduce these two custom fields. To be able to distinguish the standard field from the custom fields, we add “(Demo)” at the end of the label of the approver custom field and “(demo duplicate)” at the end of the company code custom field. Their labels are now “Approver(Demo)” and “Company Code( demo duplicate)”.
We start the task of making the value help of the “Approver(Demo)” custom field context-dependent by logging in to client 100 and opening the app “Manage Purchase Orders”. There, we select one of the purchase orders listed to navigate to the purchase order details screen.
Here, we see the two custom fields on the purchase order detail screen (see screenshot below):
- the “Approver(Demo)” field with its attached read-only description field “Approver (Demo) (Desc.)”
- the “Company Code( demo duplicate)” field
When we click on the value help icon of the “Approver(Demo)” field, we get the following value help popup:
Please note that the company code filter field is empty and has not been prefilled so far with the current value of the company code field, which is “1710”.
In order to get this filter field prefilled in the value help, we have to define additional bindings for the value help of the custom field “Approver(Demo)”. To do so, we have to edit the custom field within the “Custom Fields” app. The fastest way to navigate to this app is
- to switch into the UI adaptation mode by clicking on our avatar on the right upper corner of the screen. Then, select the “Adapt UI” option.
- Right-click on the custom field “Approver(Demo)” or any other field in that section, and within the menu that is now popping up, select “Add: Field” (see screenshot below).
A dialog is popping up showing the list of available fields. In this dialog, there is a “+” button on the top right corner that you can use to create new custom fields, or maintain already existing custom fields. Since we want to maintain already existing custom fields, we click on this button. It directly navigates us to the “Custom Fields” application and opens the “Custom Fields” tab. We‘re now searching for our already existing custom field “Approver (demo)” and by clicking on its entry on the list, we navigate to the details of this custom field.
There, we open the “UIs and reports” tab and we navigate to the list entry “Manage Purchase Order”, which is the entry that represents the exposure of the custom field to our UI “Maintain Purchase Orders”. Within this list entry, we see an active button with a pencil icon that has the tooltip “Maintain Value Help Bindings”, which is what we want to do. Selecting the pencil icon, the following popup is displayed (see screenshot below):
On this popup, we can now define the binding of the company code value help filter field via a drop-down list. We do so by selecting the company code custom field as data source field, and then we click “OK” and save our changes. In the end, we can publish the custom field.
Restarting the UI, we can open the value help for our “Approver (demo)” again. The company code filter field is no longer empty but has been prefilled with the current value of the company code field which is “1710”. Also, all offered value help entries are automatically filtered by this value.
Now you are done! Congratulations!
For further information refer to the official documentation.
This blog focuses on SAP S/4HANA Cloud. We have some good news: this doesn’t only work in SAP S/4HANA Cloud starting with release 2208, but it also works in your SAP S/4HANA (on premise) system starting with release 2022.
Please note that the feature “Value Help Binding” is currently not available for all types of UIs.
Whether it‘s available on a specific UI or not depends on the technology on which the UI‘s backend service is built. Currently, this feature is supported for OData services built with the newest OData service exposure technologies, which are
- Referenced Data Source
- Service Definition/Service Binding
Please note that in order to implement the described scenario in SAP S/4HANA Cloud, you need a user in the customizing tenant (client 100). The following business roles have to be assigned: SAP_BR_PURCHASER, SAP_CORE_BC_EXT_FLD, SAP_CORE_BC_EXT_FLEX.
Feedback, Comments, or Questions
You’re cordially invited to provide them in the comments section below. Also, please follow my profile to get updates when I publish more posts on these topics.
Also feel invited to post and answer questions here (https://answers.sap.com/tags/270c4f37-c335-46e1-bfad-a256637d5e26) and read other posts on the topic (https://blogs.sap.com/tags/270c4f37-c335-46e1-bfad-a256637d5e26/).
I want to thankYasmina van Rooij and Karsten Schaser for their extremely helpful contributions.