Technical Articles
Key User Extensibility: Create a Custom Code List with a Custom CDS View in SAP S/4HANA Cloud
In this blog, I will take you through the steps for creating a Code List with a Custom CDS View in SAP S/4HANA Cloud.
Introduction
You would have already seen how to create Custom Code lists(You may refer to this document and blog for more information on this) and use them in your custom fields to create F4 helps.
With this feature, you can create Custom fields which uses Custom CDS views as code lists. This means that you can create a custom CDS view that will fetch data from released data sources of your choice and then you can use that CDS view as a source for your custom field, thereby increasing the scope of Custom fields vastly.
Create a Custom Field
Create a custom field by selecting the tile Custom fields and Logic under the Group Extensibility
Create a new Field with type as ‘Code List with Custom CDS View’ and select the Custom CDS view from the drop-down list
I have already created a custom CDS view YY1_CUSTOM, which fetches all the purchase orders created in the system and I will use this CDS view to create the new Field. You can refer the blog for more information on how to Create a custom CDS view in SAP S/4HANA Cloud
Once I click on create and edit, I will maintain the necessary UI’s and reports which will use this field.
Save and Publish the custom field.
Now, since this is added to the Sales Order GUI, you will be able to see this custom field added under the tab Custom Fields in Sales Order Header.
When I click on the search help field, it will open up the Purchase Order list which is returned from my Custom CDS view
I can select a Purchase Order from the list as a Reference Purchase Order and save the Sales Order.
This shows how simple and powerful it is to add a new F4 help which fetches data directly from the released data sources, instead of fetching from code lists.
Edit 2/06/2022 :
New Value Help Scenario
With the SAP S/4HANA Cloud 2202 release, the new Custom CDS Views scenario “Value Help” has been introduced. This is documented in the blog by Andreas Riehl
Thanks for publishing handy blog-post on the topic very useful to the S/4HANA Cloud user community!
Hi Prasanth Padmanabhan Menon
Can you please let me know how can we display the non-key field value of the custom CDS view in the custom field?
For example, we are using the custom CDS view in the search help of a custom field to display the list of employees in the system with the SAP Personnel number as key field and employee name as another non-key field. When I use it in the screen, the value in the custom field will be the personnel number. What should I do to display the employee name instead?
Regards,
Ann Paul
Hi Ann,
The value that the field will take over will be that of the key field that is defined in the custom CDS view.
Best Regards,
Prasanth
Thank you for the clarification!
Hello. can you help me. The option Create a Custom Code List with a Custom CDS View is not showing
Hi Fernando,
Which release of S/4HANA Cloud are you on now right now?
Best Regards,
Prasanth
Hello. Is S/4 Hana on premise release 104.
Hi Fernando,
Please upgrade to the latest available release of S/4HANA OP for this feature. This is available from SAP S/4HANA 2021 release.
Best Regards,
Prasanth
Hi Prasanth Padmanabhan Menon
Thanks for this helpful contribution! In the meantime, there is also a dedicated scenario for value helps in the custom CDS views app that removes some of the flaws that the former workaround had. I described this very briefly in the 2022 update for Custom CDS Views.
Best Regards,
Andreas
Hi Andreas,
Thanks for this. This is a widely requested feature
Best Regards,
Prasanth