Introduction:
This Blog post provide information and understanding on very important features in S4HANA Embedded Analytics which is Text, Attributes, and value help in CDS views.
Overview:
We face multiple requirements in Reports based on CDS views related to text, Attributes and Value help.
This can be achieved through various methods, in this Blog Post we will discuss few methods, their advantages and advantages. Sometimes we already standard CDS views for Dimensions and Text and sometimes we have to create them manually.
Solution: Lets discuss below methods to understand the concept:
Method 1: Using CDS View as Master Data View
This method is like Master data concept in SAP BW, there we have Master Data Info objects containing attributes and Text tables. Then in info providers we can assign their property to the fields coming from source.
Similarly, here we create Dimension View which will have Attribute data and Text View which will have text data. Then we will use the text view in Dimension View to make it Master Data and further use this Dimension view in our Transaction Data (Basic/Composite View).
Case 1. When we don’t have standard Dimension and Text view available for required field:
SAP has already provided Standard Dimension and Text View for most the fields, Example: I_Material , I_CompanyCode etc. However, there are some fields where we do not have Standard Views available, depending upon the report requirement we might need to create them.
Let’s take field BWMOD/KKREF, these fields contain same data, BWMOD is coming from T030 table and KKREF from T025L to get the text. Here we don’t have Standard Dimension and Text View on this field. Therefore we will use above to create our Dimension and text Views.
Note: To get the attributes we must have dimension view and to have text field we must have text view.
Let’s see how:
Step 1. Create Text View. Here important annotations are :
@ObjectModel.dataCategory: #TEXT –
@ObjectModel.representativeKey: ‘ValuationGroup’
@Semantics.language: true
@Semantics.text: true
Text CDS view code with annotations:
@AbapCatalog:{
sqlViewName: ‘IAMTEXTVIEW’,
preserveKey: true,
compiler.compareFilter: true
}
@ObjectModel.dataCategory: #TEXT
@VDM.viewType: #BASIC
@ObjectModel.representativeKey: ‘ValuationGroup’
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: ‘Text View on Valuation Group’
define view IAM_TEXT_VIEW
as select from t025l
{
key t025l.kkref as ValuationGroup,
@Semantics.language: true
key t025l.spras as Language,
@Semantics.text: true
t025l.krftx as ValuationGroupName
}
Step 2. Create Dimension View on T030 Table where one of the fields is BWMOD, Take the distinct value for BWMOD and use above created Text view in association and provide CDS level and field level annotations as given below:
Note: When we don’t have separate table for BWMOD/KKREF, we can use distinct in CDS view as we used for below table, but we have table for KKREF which is T025K and hence we can also use directly T025K table without using distinct in our view.
Important points in Dimension CDS view:
1. Annotations:
@Analytics: { dataCategory: #DIMENSION}
@ObjectModel.text.association: ‘_TEXT’
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
2. Association with Text View
Dimension CDS view code with annotations:
@AbapCatalog: {
sqlViewName: ‘IAMDIMENSIONVIEW’,
compiler.compareFilter: true
}
@AbapCatalog.preserveKey: false
@Analytics: { dataCategory: #DIMENSION}
@VDM.viewType: #BASIC
@EndUserText.label: ‘Dimension View on Valuation Group’
@Search.searchable: true
@ObjectModel.representativeKey: ‘ValuationGroup’
define view IAM_DIMENSION_VIEW
as select distinct from t030
association [0..*] to IAM_TEXT_VIEW as _Text on $projection.ValuationGroup = _Text.ValuationGroup
{
@ObjectModel.text.association: ‘_TEXT’
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Search.ranking: #HIGH
key t030.bwmod as ValuationGroup,
_Text
}
Step 3: Use association in Basic View/Composite view with above Dimension view and provide the field level annotation and express the association as below till Composite View:
Case 2. When we have standard Dimension and Text view for available for required field:
Some difference between two methods:
Using Master Data (Method 1) | Using Text (Method 2) |
Everything related to Master Data, Text and even Heirarchy can be achived from one view | Only used for text |
Association with Dimension View withText View is required | Only Text View is enough |
Annotation to be used at composite level:@ObjectModel.foreignKey.association: ” | Annotation to be used at composite level:@objectmodel.text.association: ” |
It will take care of language automatically | Language has to be filtered at text level if present in text, not suitable where we have muktple language Reports |
No comments:
Post a Comment