Fiori CDS View Value Helps

Hello friends if you are looking for Fiori CDS View Value Helps notes | CDS Views Value Help For Fiori App Development | Fiori App CDS View Value Helps Managed and Unmanaged Scenario | CDS View Most Commonly Used CDS View Value Helps

In Fiori, CDS (Core Data Services) views are often utilized to provide data to applications in a structured and efficient manner. Value Helps, in the context of Fiori CDS views, refer to the mechanism used to enhance user experience by providing assistance or suggestions while entering data into input fields.

Definition:

Value Helps in Fiori CDS views are used to offer users assistance or suggestions when entering data into input fields within Fiori applications.
They help users by providing a list of values, descriptions, or possible selections based on the input field’s context, making data entry more intuitive and efficient.
Implementation:

Value Helps in Fiori CDS views are typically implemented using annotations and associations.
Annotations such as @Search.searchable and @Consumption.valueHelpDefinition are used to define which fields should have value helps and how they should behave.
Associations between different CDS views or entities can be established to fetch related data and present it as value helps for input fields.
Types of Value Helps:

There are various types of value helps that can be implemented in Fiori CDS views, including:
Fixed Value Lists: Providing a predefined list of values for selection.
F4 Value Helps: Offering dynamic value helps based on data retrieved from associated CDS views or entities.
Hierarchical Value Helps: Supporting hierarchical data structures for complex selection scenarios.
Enhanced User Experience:

Value Helps significantly enhance the user experience by reducing manual input errors and improving data accuracy.
Users can quickly select values from the provided list or make informed decisions based on the suggestions offered by the value helps, leading to increased productivity and satisfaction.
Integration with Fiori Applications:

Fiori applications can leverage Value Helps defined in CDS views to enhance their user interfaces.
Input fields within Fiori apps can be configured to trigger value helps when users interact with them, providing seamless integration between the application logic and data retrieval mechanisms.
Customization and Extensibility:

Value Helps in Fiori CDS views can be customized and extended to meet specific business requirements.
Developers can define custom annotations, associations, and logic to tailor the behavior and appearance of value helps according to the application’s needs.

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

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

APPROACH 1 – Value help based on Modelled View

Requirement

Display a value help for Buyer ID

Solution

Annotation for getting a selection field

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)

In order to get a value help, we need to follow the below steps.

STEP 1: Create a value help CDS

For our example, I have created the below CDS.

@AbapCatalog.sqlViewName: 'ZDEMOPARTNER' 
@AbapCatalog.compiler.compareFilter: true 
@AbapCatalog.preserveKey: true
@EndUserText.label: 'Value help for BP'
define view zc_demo_partner_vh
as select from but000 
{
key partner as partner, 
name_org1 as Name1
}

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 
{
as SalesOrderKey,
as SalesOrderExternalId,
key so_key     
id 
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

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

Step 2: Use the value help view in Consumption view

Below are the differences compared to Modelled approach

  • Add association to the value help provider
  • Use @ObjectModel.foreignkey.association annotation

Requirement 2

Creating a value help “with text”

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.

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

Overall, Value Helps in Fiori CDS views play a crucial role in improving the usability and effectiveness of Fiori applications by offering users assistance and suggestions during data entry. By leveraging Value Helps, Fiori applications can provide a more intuitive and efficient user experience, leading to higher user satisfaction and productivity.

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.

Leave a Comment