0% found this document useful (0 votes)
7 views

Filters and Value Helps in Virtual Data Model - Part 2

Uploaded by

Bo Zhang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Filters and Value Helps in Virtual Data Model - Part 2

Uploaded by

Bo Zhang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

VDM 2 – S/4HANA Embedded Analytics Using


CDS Virtual Data Model – Value Helps &
Annotations
By Venkat Boddu - December 3, 2019

Shares

In our other tutorial, we learned that Embedded Analytics means Built-in Analytics in S/4
System. Core Data Service and Virtual Data Model Models are one of the pillars of
Programming Models in S/4HANA. In this tutorial, we will try to learn the simple yet very
practical concepts viz: Value Help, Filters
Filter and Annotations in Fiori and Analytical Tools.

If you are not aware of VDM and Embedded Analytics. Please refer to my previous article on
Virtual Data Model.

By the end of this tutorial, you will learn:

How to Create Value Helps in Fiori, Analytical Tools, and usage of Different
Annotations.

There are two different ways to create Value Help.

Based on foreign key associations – With this approach, only the key fields and the
text elements of a help value provider view are exposed as value help related fields.

Based on modeled value help views – The second option is to precisely define the
value help-relevant fields by creating a dedicated CDS view (modeled view) that is
associated as the value help in the consuming CDS view.

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 1/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

2 Types of Value Help

A scenario of Value Help in CDS View:


We created the Consumption Sales Order CDS View for List Report. Customer is Selection
Field in the CDS view and we created Value Help for the Customer and Customer in turn
should fetch based on the country.

For our exercise today, we will create CDS Views for Value Help and Filters.
Filter Created
Basic CDS views on VBAK (YVDM_C_SOH – Consumption CDS view),
YVDM_KUNNR_VH (Value Help CDS view) and used Standard views
I_DistributionChannel, I_SalesOrganization, I_Country in the mentioned CDS views.

1. Annotations:

Used below annotation to achieve the value help and filter functionality. We have
not used all annotations in my example but we used standard views. In the
standard views all these annotations are used.

@ObjectModel.foreignKey.association:’_AssicationName’: This Annotation is used for


Value Help from association based on the Key Field.

@ObjectModel.text.element: [‘Fieldname’]: This annotation is used for Value Help for


Key field to display the Text also. E.g field name is Customer Name for Customer Number.
https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 2/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

@Consumption.valueHelp: This Annotation is used for Value Help from Associations.

@Consumption.valueHelpDefinition: This Annotation Used for Value Help from another


CDS view or Value Help CDS.

@Consumption.filter:
filter This annotation enables the selection option variable and filtering
filter
elements
Shares of the underlying view. We can give default value, range, multiple selections and
mandatory, etc.

@Search.searchable: True: This annotation is necessary to define that the search


function is supported for the view.

@Search.defaultSearchElement: True: It is possible to search for the annotated field in


the freestyle search field in the value help dialog

@Search.fuzzinessThreshold: 0.8: How fuzzy the text search applied to the annotated
field should be, For example, value 0.8 refers to a similarity of 80%.

@Analytics.dataExtraction.enabled: If set to true, the view is suitable for data


replication.

Semantics Annotations:
@Semantics.currencyCode: This annotation tags a field containing a currency code

@Semantics.amount.currencyCode: The annotated field contains the amount, and the


corresponding currency code is contained in the referenced field.

@Semantics.unitOfMeasure: This annotation tags a field containing a unit of measure

@Semantics.quantity.unitOfMeasure: The annotated field contains a quantity, and the


corresponding unit of measure is contained in the referenced field

@ObjectModel.dataCategory: #VALUE_HELP: It is used to better understanding of


value Help Views

@Consumption.valueHelp: Assign the Association name to the annotated View

@Consumption.valueHelpDefinition: Assign the Other CDS entity name and Element


Name

@ObjectModel.text.association: ‘_Text’: The relationship between a field and its


language-dependent descriptive text field(s) and This Annotation points to a language-
dependent text view. Its cardinality is [0/1..*].

TEXT View:

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 3/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

@ObjectModel.dataCategory: #TEXT: Text views should only be defined for language-


dependent texts.

@Semantics.language: True: The language field that is used in the text view must be a
key field and The language field Should be annotated.

@Semantics.text:
Shares true: At least one non-key field has to be defined as a text field in a
text view.

Example of the above Annotations Usage in Standard CDS


Views:
Standard CDS View I_DistributionChannelText used in the Standard Distribution Channel
View I_DistributionChannel shows the dataCategory TEXT annotations.

Examples of Other Annotations:

Example of an Association:

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 4/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Example of ObjectModel.Text.Association used in the standard View I_DistributionChannel

Shares

Also Read: CDS Part 15. Associations in CDS Views – I

Note: Value Help and Text Views are NOT categories of views. These are just typed
and used for better understanding.

Custom Basic View – VDM 1


CDS View: YVDM_KUNNR_VH (BASIC, ValueHelp) and used Standard CDS View I_Country

You may download the source code using below link.

YVDM_KUNNR_VH Download

Custom Consumption View – VDM 2


CDS View: YVDM_C_SOH (CONSUMPTION, CUBE) and used Standard CDS views
I_DistributionChannel, I_SalesOrganization.
https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 5/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

You may download the source code using below link.

YVDM_C_SOH Download

OData Service Activation:


Please refer to My Previous Post about OData Service Activation for detailed steps.

Execute the t-code /n/iwfnd/maint_service and press the Add Service button. In the
Add Selected Services, a screen provides a System Alias and then presses the Get Services
button. The Technical Service Name field, YVDM_C_SOH (Consumption View from above
step), can be provided to filter the results if necessary. Selecting the service should result
in the Add Service dialog appearing. Here you can assign it a package and choose the enter
button to complete the process.

Also Read: CDS Part 3. Expose CDS Views as OData Service through Annotation

2. Fiori Apps using List Report Template:


Create Fiori App from Standard Template using SAP WebIDE Full-Stack. This SAP WebIDE
Full-Stack will open from SAP Cloud Platform Cockpit.

Here we connected Cloud Connector and SAP Cloud Platform Cockpit.

Select Project from the template in the SAP WebIDE Full-Stack and select the List Report
Application

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 6/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

Select the S/4Hana System and OData Service and click on the finish button.

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 7/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

Select the Annotation file

Select the OData Collection and Finish

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 8/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

Click on RUN -> Run as Web Application

Fiori List Report First Screen:

Sold-To-Party and Sales Organization fields are mandatory as we used Mandatory: True as
shown in the below annotation.

@Consumption.filter:
filter { selectionType: #INTERVAL, multipleSelections:
true,mandatory: true}

For Distribution Channel we used below UI Annotation.

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 9/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

@UI.selectionField: [{position: 40}]

Note: Consumption Annotation can be used in Fiori and Analytical tools (BW
queries, Analysis For Office and Other Tools) but UI Annotations can be used only in
Shares
Fiori.

Click on F4 in Sod to party.

@Search annotation is used in the Value Help View and because of it, the below search
button was displayed.

Click on F4 on the Country and select the Country.

We found the respective country customers based on the value help.

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 10/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

Final Output:

3. Transient Provider Report:


T Code – RSRTS_ODP_DIS

Input the CDS SQL View and Not the CDS Entity View Name and Execute it.

Click on the Standard Query Button

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 11/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

Sales Org Value Help and Sold to Party are displaying in the report. But did you notice,
Distribution Channel selection is not showing in the analytical queries? Why?

Because we used UI Annotation – @UI.selectionField: [{position: 40 }]. As


mentioned earlier, UI Annotations work only in Fiori Apps.

Now we will change @UI.selectionField: [{position: 40 }] annotation for Distribution


Channel to @Consumption.filter
filter Annotation to show the selection field in the Analytical
tool.

Distribution Channel filter is available now.

Provided the Mandatory Selection values and executed the report.

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 12/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Shares

We should pick the fields for Row characteristics / Column characteristics.

If you are using @Anlytical.query: True (BW Query – Transient Query) then you can write
the below annotations to GET the fields automatically but below annotations will NOT
work for annotation @Analytics.dataCategory: #CUBE(Transient Provider)

@AnalyticsDetails.query.axis: #ROWS
@AnalyticsDetails.query.axis: #COLUMNS
@AnalyticsDetails.query.axis: #FREE

CDS views with the annotation @Analytics.query: true are transient queries which can be
interpreted by the Analytic Engine.

CDS Views with the analytic annotation @Analytics.dataCategory:#CUBE are transient BW


providers.

Try some Quizzes and Hands on Exercise on ABAP CDS – From our Oct and Nov
2019 Batches.

This is my second article on Virtual Data Model. Do provide your feedback and suggestions.
Based on your comments, I will plan my next tutorial. Please keep visiting our page and
sharing.

Do join 5735+ SAP Technical Consultants in this Telegram SAP Technical Discuss
Group. Ask, Answer and Learn is our Motto. You need to install Telegram App first
in your mobile or desktop and then click the joining link.

Please SUBSCRIBE to SAPYard’s Youtube Channel for Free End to End SAP Video
Course and Training.

Step by Step Tutorials on VDM

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 13/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

VDM 1 – S/4HANA Embedded Analytics Using CDS Virtual Data Model

VDM 2 – S/4HANA Embedded Analytics Using CDS Virtual Data Model – Value Helps &
Annotations

CDS Part 18 – Bar Chart & Donut Chart using CDS Views

VDM 3 – S/4HANA Embedded Analytics Using CDS Virtual Data Model – Meta Data
Shares Extensions(MDE)

Step by Step Tutorials on CDS

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 14/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

CDS Part 1. Core Data Services – Introduction

CDS Part 2. Core Data Services – Deep Dive

ABAP on SAP HANA. Part XII. Open SQL, CDS or AMDP, which Code to Data Technique to
use?

CDS Part 3. Expose CDS Views as OData Service through Annotation


Shares
CDS Part 4. Data Access in S/4HANA Cloud – CDS View Introduction

CDS Part 5. ABAP CDS Views With Authorization

CDS Part 6. Basic Expressions & Operations Available for CDS View – I

CDS Part 7. Basic Expressions & Operations Available for CDS View – II

CDS Part 8. Usage of Built-In Functions in CDS – I

CDS Part 9. Usage of Built-In Functions in CDS – II

CDS Part 10. Usage of Built-In Functions in CDS – III

CDS Part 11. How to Consume CDS View in Smart Business Service KPI Fiori Apps?

CDS Part 12. Useful 6 CDS Related Tools in ADT

CDS Part 13. Key Definition in CDS Views

CDS Part 14. ABAP Annotations for Translatable Texts in CDS Views

CDS Part 15. Associations in CDS Views – I

OData Service from CDS Annotation Not Working in Browser Mode

CDS Part 16. Usage of Built-In Functions in CDS – IV

CDS Part 17. How to Overcome GUID Mismatch Linking Problem in ABAP CDS?

ABAP CDS Online Training – October 2019 Batch

VDM 1 – S/4HANA Embedded Analytics Using CDS Virtual Data Model

VDM 2 – S/4HANA Embedded Analytics Using CDS Virtual Data Model – Value Helps &
Annotations

CDS Part 18 – Bar Chart & Donut Chart using CDS Views

VDM 3 – S/4HANA Embedded Analytics Using CDS Virtual Data Model – Meta Data
Extensions(MDE)

How to Append Standard Tables having Replacement Objects in S/4HANA

ABAP Programming Model for SAP Fiori – 2 – CDS – Introduction

ABAP Programming Model for SAP Fiori – 3 – CDS Views Creation

CDS Part 19 – Finding Week of the Year in CDS Views

CDS Part 20 – Virtual Elements (ABAP Functions) in CDS

ABAP Programming Model for SAP Fiori – 13 – How to Preview and Download PDF in Fiori
Apps

CDS Part 21 – CDS View Finder Tool

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 15/16
6/26/2020 Filters and Value Helps in Virtual Data Model - Part 2 |

Venkat Boddu
Shares Extensively worked on ABAP, ABAP on HANA , ODATA with 13+ Years of Experience in the Industry.

https://sapyard.com/vdm-2-s-4hana-embedded-analytics-using-cds-virtual-data-model-value-helps-annotations/ 16/16

You might also like