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