Professional Documents
Culture Documents
SAP Fiori Using CDS
SAP Fiori Using CDS
VALUE HELPS
- Modelled value help views
- Foreign key association
Pratik Vaidya
Welcome to another document of SAP Fiori using CDS. In this document we will have a look
at how to create value helps for an element.
Prerequisite
The application used for demonstration of this topic has been created in previous the
document – SAP Fiori using CDS – FACETS. Hence, I would strongly recommend you to go
through the below link
https://www.linkedin.com/posts/pratikvaidya9_cds-fiori-elements-facets-activity-
6778233064691703808-UFBZ
More information
For more information on this topic, do check the below link.
https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.52.3/en-
US/ce9deec2b91746f7b2f1ca4421256754.html
Requirement
Display a value help for Buyer ID
Solution
As we can see, Buyer ID already has an F4 view attached. But clicking on it would not give us
a value help, it only gives us an ability to filter the search.
(after clicking on F4)
This CDS fetches the Partner number and Name1 from Business Partner table.
STEP 2: Use the Value help CDS, in our Consumption view
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Consumption view for sales orders'
@Metadata.allowExtensions: true // To allow metadata extensions
@VDM: { viewType:#CONSUMPTION,
usage.type: [#TRANSACTIONAL_PROCESSING_SERVICE] }
define root view entity zc_demo_salesord_pv
as projection on zr_demo_salesord_pv
{
key so_key as SalesOrderKey,
id as SalesOrderExternalId,
lifecycle_status as LifecycleStatus,
@Consumption.valueHelpDefinition: [{ entity.name: 'zc_demo_partner_vh',
entity.element: 'partner' }]
buyer_id as BuyerId,
ship_to_id as ShipTo,
...
Use the highlighted annotation to get a value help for the required field.
Output
A new tab “Search and Select” is added, earlier we only had “Define conditions”.
APPROACH 2: Value help using Foreign key association
NOTE: The examples I am creating are using Restful application programming model. I am
not sure if Foreign key association approach works in RAP, hence using screenshots from my
earlier notes for its demonstration.
Requirement 1
Creating a value help “without text”.
Here we would be creating value help for Sales organization field.
Solution
This approach is similar to the Modelled approach, only annotation used in Consumption
view is different.
Step 1- Create a value help CDS
Solution
This approach is similar to “Value help without text”, only difference is that a text
association comes into picture.
Step 1: Create a text provider view for our value help view.
In our case, fetch the Sales organization text from TVKOT and provide it to Sales
organization in the value help.
Note: Don’t miss the highlighted annotations.
Step 2: Create a value help CDS and use the text from the text provider CDS
Note: @Objectmodel.text.association for text association
Step 3 : Use the value help CDS in the consumption view
If you have made it this far, I hope you have understood the concepts demonstrated. Please feel free
to reach out to me if you feel any concepts have been explained incorrectly / there is more to it than
demonstrated.