Do you want to create a key user custom field of type “Code List based on CDS view” but you do not know
1) which is the right Semantic Object and Semantic Object Parameter you need to add as UI navigation info to your custom field or
2) how to find or create the value help view on which this custom field should be based on?
If your answer is yes, then this blog post is just for you.
This blog post covers the following topics:
- How to find the right Semantic Object and Semantic Object Parameter you need to add as UI navigation info to a custom field to navigate at runtime to the respective target UI
- How to find or define the value help view on which the custom field should be based on for a given target UI
How to find the right Semantic Object and Semantic Object Parameter
For a custom field of type “Code List based on CDS view” you can add a so-called UI navigation. When doing so this field becomes a link in display mode within the extended application UI. For a UI navigation you have to configure the respective Semantic Object and Semantic Object Parameter in your custom field. This information is required for SAPs Fiori UI navigation technology, also known as Intent-Based Navigation (see SAP help documentation for further information). The question is now which Semantic Object and which Semantic Object Parameter you should enter in the respective navigation attributes of the custom field. You can find further information on how to enrich custom fields with Intent-Based Navigation in this blog.
The first point you need to clarify is what is the target UI you want to navigate to.
There may be cases where you already know for which target UI you are looking for (e.g. because you already worked with it). There maybe are also cases where you only know to which business object you want to navigate to and whether this should be a read-only UI or one with instance maintenance capabilities.
Either way your starting point is the Fiori apps library:
https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer
Let’s assume you want to create a custom field of type “Code List based on CDS view”, which uses the SAP standard value help CDS view “I_WorkforcePersonVH” as value help view. For this custom field you would like to configure a forward navigation to the app “Employee”, which shows the data of the referenced employee.
Within the Fiori apps library, you find the following entry when searching for the “Employee” app:
https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps(‘F5526’)
To identify the Semantic Object that belongs to this app, navigate to the “IMPLEMENTATION INFORMATION” tab of the Fiori apps library entry of this app. There select the “Configuration” section and scroll down till you reach the “Target Mapping(s)” table. Here you see that the Semantic Object of the app is “WorkforcePerson”.
The next step is how to find the Semantic Object Parameter you have to configure in the custom field. This Semantic Object Parameter is usually not described in the “Target Mapping(s)” description and how to figure it out heavily depends on how the UI has been implemented.
A lot of the SAP standard Fiori UIs are implemented using the “SAP Fiori Elements” technology. This technology renders a UI based on backend supplied metadata. You can find more details regarding the SAP Fiori Elements programming model here. One common use case is the navigation to a so-called object page. For such a navigation the URL must contain either all the technical keys or all the semantic keys of the entity set belonging to the object page. You can find more information about the navigation to a Fiori Elements app in this documentation.
Whether your target UI at hand is an SAP Fiori Elements UI or not can be figured out by having a look in the manifest of the UI. If this manifest contains a fragment “sap.ui.generic.app” then it is an SAP Fiori Elements UI.
For SAP Fiori Elements UI’s the Semantic Object Parameter can be identified in the following way:
- Based on the Fiori apps library entry of the target application you can identify the underlying OData service. There you find it in the IMPLEMENTATION INFORMATION tab within the “Configuration” section.
In our “Employee” app example this is OData service “WFD_EMPLOYEE_FS_CE_SRV” - With the OData service information, you can assemble the second part of the URL that leads us to the OData metadata: “/sap/opu/odata/sap/WFD_EMPLOYEE_FS_CE_SRV/$metadata”. The first part of the URL depends on the S/4HANA system you are working with. The easiest approach is to take the URL of your target UI and replace the part beginning with “/ui#”.
In our example the application URL looks like this: https://myXXXXXX.s4hana.ondemand.com/ui#WorkforcePerson-displayFactSheet&/C_WorkforcePersonOPg(‘5256396’).
Therefore, the OData metadata URL would be: https://myXXXXXX.s4hana.ondemand.com/sap/opu/odata/sap/WFD_EMPLOYEE_FS_CE_SRV/$metadata
- When we now analyze the OData metadata of this OData service, we can figure out the name of the entity type, which carries the data of the object instance to which we would like to navigate – the target entity type so to say. In our example this entity name is “C_WorkforcePersonOPgType” and the technical key can be found within the OData metadata:
<Key><PropertyRef Name=”PersonExternalID”/></Key>
Note that in some SAP Fiori Elements apps the semantic key is explicitly defined. In this case the entity type has an additional annotation:
<Annotation Term=”SAP__common.SemanticKey”>
This annotation carries the Semantic Object Parameter in one of its collection entries: <PropertyPath>SemanticObjectParameterName<PropertyPath>
In our example “Employee” app, there is no explicit definition of the semantic key. So, the Intent Based Navigation utilizes the technical key information. Therefore, the Semantic Object Parameter Name is PersonExternalID.
Let us dive a little bit deeper into the question how you can find out the target entity type:
- Open the target UI and there open the UI5 diagnostics dialog by pressing keys Ctrl+Alt+Shift+S
- Unfold the option „Control Tree“
- Click on e.g., section “Basic Data” of your UI, while pressing Ctrl+Alt+Shift keys. This will highlight the selected control within the control tree.
- Click on the “Binding Infos” tab
- You see a section “Contexts”, which contains “Path” information
- The very first fragment is the target entity set (in our example “C_WorkforcePersonOrg”)
The next step is now to find or define the value help view on which the custom field should be based on.
How to find or define the value help CDS view on which the custom field should be based on
Let’s assume you already figured out the Semantic Object and the Semantic Object Parameter (that is what we did in the previous paragraph), which should be used in your UI navigation. Now you need to find or create a suitable value help CDS view for your custom field of type “Code list based on CDS view”. In this case you must make sure that the key field of the value help CDS view is semantically identical to the Semantic Object Parameter. The name can be different, but it must be semantically identical (same technical type and same meaning).
In addition to that in almost all cases it may be helpful when there is a description field assigned to the key field of the value help view. At runtime that leads to the fact that whenever the custom field is rendered in display mode not only the key field value is shown, but also the value of the description field.
The best choice is always that you find a C1 released (released for “USE_IN_KEY_USER_APPS”) SAP standard CDS view that exactly fits your needs.
How to search for such a CDS view:
The first and easiest to explore source of information is the SAP API Business Hub. How to do that is described in this blog.
This blog does not only show you how to find a C1 released SAP standard CDS View using SAP API Business Hub, but also shows you a second option – that is to use the “View Browser” app.
There is a third option that is especially interesting for those of you who most of the day work within ADT. There you have a rich search functionality that can be combined with the “ABAP Repository Trees”.
How you can apply filters for the relevant object types (in our case it is “DDLS”) and combine them with other filters is described in detail in this blog. In our case you should restrict your search to objects where “api:USE_IN_KEY_USER_APPS” and “type:DDLS”. On top of that you can apply your own name search pattern.
You can use this search string directly in the “Open ABAP Development Object” functionality. You can also use it when defining an ABAP repository tree where you enter the name search pattern in the “Object Name Pattern” area and the property filter information in the “Property Filter” area.
If you have not been successful finding a suitable C1 released SAP standard CDS view, then the next best option is to create your own key user custom CDS view that has the respective key field and description field. How to create such a custom CDS view is described in this blog. In the simplest case a C1 released SAP standard CDS view is quite close to what you want, but simply has too many fields in which you are not interested in. Then you could create a custom CDS view selecting from this SAP standard CDS view simply leaving out the unwanted fields.
In cases where the functionality of the key user custom CDS view tool does not support the necessary changes or when you do not find a suitable SAP standard CDS view as basis for your custom CDS view, there is one more option that provides a maximum of flexibility: You can create a developer extensibility custom entity, which allows you to program your value help completely in ABAP. This blog shows you how to do that. This last option offers a maximum of flexibility but also comes with significant implementation effort.
Using the above-mentioned alternatives, you can find the value help CDS view for the custom field. In our “Employee” app example this is value help CDS view “I_WorkforcePersonVH”, which also comes with a suitable description field:
There, the annotation @ObjectModel.text.element points to the description field PersonFullName.
Some prominent example combinations of value help views and Intent-Based Navigation information
The table below shows some prominent example combinations of C1 released SAP Standard value help CDS views together with potential target applications, their respective Semantic Objects and Semantic Object Parameters.
SAP Standard CDS View | Target App | Semantic Object | Semantic Object Parameter |
I_WorkforcePersonVH | Employee | WorkforcePerson | PersonExternalID |
I_Customer_VH | Customer – 360° View | Customer | Customer |
I_Supplier_VH | Supplier | Supplier | Supplier |
Example value help views with potential target apps and Intent-Based Navigation info
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 thank Yasmina van Rooij and Karsten Schaser for their extremely helpful contributions.
Other related blog posts:
If you interested in the details how to implement a Custom Entity I recommend the blog post “How to implement a custom entity in the ABAP RESTful Programming Model using remote function modules” from Andre Fischer .
Custom fields in S/4HANA: Key User versus Developer Extensibility
https://blogs.sap.com/2022/06/23/easily-manage-your-key-user-adaptations-with-sapui5-flexibility/