I was searching for different blogs for this F4 help but unfortunately couldn’t find a detailed blog on this. So, I felt to start writing the same for all technical developers.

For creation of CDS view we have 3 main interface view to be created.

Step 1.

First create a CDS view for Text table.

Use Object model annotations like @ObjectModel.representativeKey, @ObjectModel.dataCategory, @ObjectModel.usageType.dataClass, @ObjectModel.usageType.serviceQuality, @ObjectModel.usageType.sizeCategory, @ObjectModel.supportedCapabilities.

herewith I have also added the CDS view

TEXT%20CDS%20View-%20Basic%20View

Figure 1: TEXT CDS View- Basic View

Data Preview
Data%20Preview%20on%20the%20Text%20View

Figure 2: Data Preview on the Text View

Adding the following code for reference.

@AbapCatalog.sqlViewName: 'ZICOUNTRYTEXT'
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.representativeKey: 'Land1'
@ObjectModel.dataCategory: #TEXT
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.supportedCapabilities: [#SQL_DATA_SOURCE,#CDS_MODELING_DATA_SOURCE,#CDS_MODELING_ASSOCIATION_TARGET,#LANGUAGE_DEPENDENT_TEXT]
@Search.searchable: true
@VDM.viewType: #BASIC
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Country Text'
define view ZI_countrytext 
as select from t005t 
{
@Semantics.language: true
    key spras as Spras,
    key land1 as Land1,
    
    @Semantics.text: true
      @Search.defaultSearchElement: true
    landx as Landx
}

 

 

Step 2.

Then associate the text view with Data table.

Data%20Help%20View

Figure 3: Data Help View

Data preview for Help.

Data%20Preview

Figure 4: Data Preview

Adding the following code for reference.

@AbapCatalog.sqlViewName: 'ZICOUNTRY'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Country Help'

@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.representativeKey: 'Land1'
@ObjectModel.sapObjectNodeType.name: 'Land1'
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.supportedCapabilities: [#CDS_MODELING_ASSOCIATION_TARGET, #CDS_MODELING_DATA_SOURCE, #SQL_DATA_SOURCE]
@VDM.viewType: #BASIC
define view ZI_country
  as select from t005
  association [0..*] to ZI_countrytext as _countrytext on $projection.Land1 = _countrytext.Land1
 
{
      @ObjectModel.text.association: '_countrytext'
      @Search.defaultSearchElement: true
  key t005.land1 as Land1,
      _countrytext // Make association public
}

 

Step 3.

Then finally access the help data as VH simply by fetching data from Value Help.

Use these following annotations in header

@ObjectModel.dataCategory: #VALUE_HELP
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.supportedCapabilities

And add @ObjectModel.text.association at the item level to refer data as Help view to given field. Add association value from previous view alias for reference.

Value%20Help%20CDS%20View

Figure 5: Value Help CDS View

Data Preview

Data%20Preview

Figure 6: Data Preview

Code for above Value help is added below.

@AbapCatalog.sqlViewName: 'ZIDESTCOUNTRYVH'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Destination country Value Help'
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.dataCategory: #VALUE_HELP
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.supportedCapabilities: [#CDS_MODELING_ASSOCIATION_TARGET, #CDS_MODELING_DATA_SOURCE, #SQL_DATA_SOURCE, #VALUE_HELP_PROVIDER, #SEARCHABLE_ENTITY]
@Search.searchable: true
@VDM.viewType: #BASIC
define view ZI_DestcountryVH 
as select from ZI_country 
{
 @ObjectModel.text.association: '_countrytext'
      @Search.defaultSearchElement: true
      key Land1,
      /* Associations */
      _countrytext
    
}

 

 

To use it as Value help for In APP custom Fields you need to release the view (Path: Windows -> Show View -> Properties).

And finally, we can have multiple usage of these Help View for Fiori applications like Query browser in analytics, or Fiori Tile in UI5, In App Extension in BTP.

In next blog I can see how to add it in Fiori App as a custom field and get the F4 (https://blogs.sap.com/2022/11/02/create-custom-field-f4-help-view-using-cds-for-in-app-extension).

Hope you enjoyed this blog answering your technical hindrance. I would be happy to see people trying out this for their Fiori F4/Value Help issues and share valuable feedback as well. Please feel free to pound your questions.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x