Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
georg_wilhelm
Advisor
Advisor
Do you want to know how you can enrich a key user custom field of type “Code List based on CDS view” in a way that in display mode, it becomes a link that navigates you to another Fiori app showing the target business object instance?
Let’s say that within the “Maintain Customer Project” Fiori app, you want to add the custom field “Customer Advocat” that allows you to select an employee from a value help dialog and as soon as the UI switches in display mode, the field becomes a link navigating you to the “Employee” app ( link to the Fiori apps library for this app ).

If your answer is yes, then this blog post is just for you.

This blog post covers the following topics:

  • How to find or define a value help view for the custom field

  • How to create such a custom field of type “Code List based on CDS view” that allows you to select an employee from the list of employees in your company

  • How to define an Intent-Based Navigation on this custom field that navigates you to the “Employee” app showing the data of the referenced employee

  • How the navigation works at runtime


In the past, a forward navigation like that was limited to key user custom fields of type “Association to Business Object”. Now, it has also been enabled for the custom field type “Code List based on CDS view”.

A short recap regarding Intent-Based Navigation


Intent-Based Navigation is a concept in SAP’s Fiori technology that allows a simple semantic definition of a forward navigation while abstracting the technical implementation of the navigation target.
The simplest way to explain the elements of Intent-Basesd Navigation is to elaborate these elements on a concrete URL fragment example:




  • The Semantic Object (“SalesOrder” in this example) represents a business entity such as a customer, a sales order, or a product…

  • The Semantic Action describes an operation that can be performed on a semantic object (“displayFactSheet” in this example)

  • The Semantic Object Parameter ist “SalesOrder” where the instance with ID 27 is referenced


More details regarding Intent-Based Navigation can be found here.

Now let’s start with the implementation.

Find or define a value help view for the custom field


The first choice for a CDS view that may act as a value help view for a custom field is always a C1-released SAP standard value help view. In our case, we already have found one - the CDS view “I_WorkforcePersonVH”. We are especially lucky with this value help CDS view as its key field “EmployeeExtID” is semantically identical to the Semantic Object Parameter “PersonExternalID” of the “Employee” app which makes our life quite easy when we later on define the Intent-Based Navigation on our custom field.

In a lot of use cases you will be able to find a standard value help CDS view which is suitable out of the box.
On the other side in some cases e.g. when there are fields in the value help view you do not want to be included in the value help or you want to do similar rather simple changes in the value help view you can create a key user custom CDS view (custom CDS view blog) selecting from the SAP standard CDS view and implement your changes in this custom CDS view and then use this custom CDS view as value help view for your custom field.

In cases where the functionality of the key user custom CDS view tool does not support the features you need or when you do not find a suitable SAP standard CDS view at all that may act as a base for such a 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 which comes with an awful lot of flexibility. This blog shows you how to do that.

Now, you have identified the value help view you need for your custom field which is “I_WorkforcePersonVH”. You can go ahead with creating the custom field.

Create a custom field of type “Code List based on CDS view” that allows you to select an employee from the list of employees in your company


You start in the Fiori app “Plan Customer Projects” (Fiori Apps library entry). Note that this is just an example…you can start from any app you want as long as it supports key user custom fields. There, you select a customer project and open it. You now click on the avatar on the upper right corner and by clicking the “Adapt UI” option in the drop-down menu, you switch into runtime adaptation mode. In runtime adaptation mode, you can adapt the UI according to your needs (see also RTA blog, RTA online help) and from here you can also add a new custom field. You do so by right-clicking on the UI container where you’d like to make the custom field visible. Within the drop-down menu that is now popping up you select the “+ Add: Field” option.


Select “+ Add: Field” option within runtime adaptation mode


As soon as this has been done, a modal popup is shown which allows you to select from a list of already existing but currently not displayed fields. By clicking on the top right “+” button, you’ll navigate to the “Custom Fields and Logic” Fiori app where you can now add the respective custom field.


Select “+” button in the “Available Content Fields” popup


Within the “Custom Fields and Logic” Fiori app, click on the “+” button on the top right corner to create the new custom field. As soon as you've done that, a modal popup dialog is shown allowing you to specify the custom field.


Custom field specification dialog


Please note that the business context (“Engagement Project”) has already been preselected. It’s especially important to select “Code List based on CDS View” as field type. As soon as you have selected this field type, an additional input field “Value Help View” becomes visible allowing you to select the value help view. As you would like to have a field referencing an employee with a value help offering employees, you choose the SAP standard value help CDS view identified before(“I_WorkforcePersonVH”) as value help view. Within its field list this value help view offers the field “EmployeeExtID” as a key field, and a description field “PersonFullName” attached to that key field. That’s it. Click “Create and Publish” and the custom field will be generated.

Define an Intent-Based Navigation on this custom field that navigates you to the “Employee” app showing the data of the referenced employee


To define the Intent-Based Navigation to the “Employee” app on the created custom field, you must navigate to the edit screen of the created custom field. Then click on the “UI Navigation” switch and enter “WorkforcePerson” into the “Semantic Object” field. This field has a value help that shows all “Semantic Objects” for which our current user is authorized. Anyway you can enter any Semantic Object no matter whether you are authorized for it or not.
To make sure that you are navigated to the correct employee instance at runtime, you’ll also have to enter the “Semantic Object Parameter” column in the entry of the key field “EmployeeExtID”, which is “PersonExternalID”. As soon as you have done that, publish the field again.


Specification of Intent-Based Navigation


Now, the next step is to make the field visible on the “Plan Customer Projects” UI. Once again, we switch into the runtime adaptation mode as described in the first step and we also select “+ Add: Field” in the drop-down menu on the UI section where we want to place the custom field. This time, we don’t press the “+” button to navigate to the “Custom Fields and Logic” app, but we rather directly select the “Customer Advocat” custom field that is listed already in the “Available Content Fields” popup dialog. Please note that you have to do that twice:
- once for the customer project edit screen and
- once for the customer project display screen.
After you have done this, you have to activate this UI change by selecting the magic wand icon within the runtime adaptation menu. Now, we have completed our development. You are done! Congratulations!

How the intent-based navigation works at runtime


The next step is to try out whether and how it works at runtime. So, leave the runtime adaptation mode and select the custom field in the “Plan Customer Projects” UI.


Value help dialog on custom field at runtime


From the value help popup choose one employee and save the change. Then navigate to the display only screen. There, the field is now rendered as a link.


Custom field “Customer Advocat” rendered as a link


Click the link. A popup shows you which navigation options are available based on the semantic object “Employee” (the only options that are shown are the ones for which your user is authorized).


Navigation options offered when you click on the link


Click on the first link offered and then you’re navigated to the “Employee” app with the respective target object instance shown.


Target UI


With this we are done. Congratulations! You created a custom field of type “Code list based on CDS view” that supports a forward navigation to a specific instance of the “Employee” app.

This blog focuses on SAP S/4HANA Cloud. We have some good news: this does not only work in SAP S/4HANA Cloud starting with release 2308, but it also works in your SAP S/4HANA on premise system starting with release 2023.

Please note also that the two main difficulties when implementing this or similar use cases will most likely always be:

  1. finding or defining a suitable value help view

  2. figuring out the Semantic Object and especially the Semantic Object Parameter of the target application


Some hints on how to approach these two questions are provided in the following blog post:
https://blogs.sap.com/2023/06/07/custom-field-type-code-list-based-on-cds-view-finding-defining-the-....

Please note as well that to be able to implement and test this extension scenario, you need a respective user in the customizing tenant having at least the following business catalogs (within SAP S/4HANA Cloud):

  • For the key user extensibility apps (Custom Fields, Custom CDS View): SAP_BR_EXTENSIBILITY_SPEC

  • For the “Plan Customer Projects” app: SAP_PSP_BC_CUSTOMER_PROJ_PC

  • For the “Employee” app: SAP_HCM_BC_EMP_DSP_PC


Please note also that the simplest way to create a custom field with a value help that also supports Intent-Based Navigation is to use the custom field type “Association to Business Object”.

A couple of standard SAP Business Entities like “Cost Center”, “Country/Region”, “Currency”, “Language”, “Company Code”, “Segment” and many more are available as target business objects when you choose as field type for your custom field the field type “Association to Business Object”. In addition to that this field type also supports as target business objects all key user custom business objects you created and configured as “associable”.
Only if your use case does not fall into one of these categories you should go for the field type “Code list based on CDS view”.
Please note that it is not only possible to use SAP standard views as base for your value help. You can also create your own RAP business object using Embedded Steampunk (Embedded Steampunk blog) and on top of this create a Custom Entity and use this one as value help view for your custom field of type “Code list based on CDS view”.

Feedback, Comments, or Questions


You’re cordially invited to provide them in the comments section below. Please follow my profile to get updates when I publish more posts on these topics.
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.vanrooij  and karstenschaser for their extremely helpful contributions.

Other related blog posts and links


https://blogs.sap.com/2022/07/27/sap-s-4hana-key-user-extensibility-custom-field-with-abap-context-d...

https://blogs.sap.com/2022/07/26/sap-s-4hana-key-user-extensibility-powered-by-embedded-steampunk-cu...

If you’re interested in the details of 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 module...   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/

RuntimeAdaptationOnlineHelp
3 Comments