

Count Not Zero Exception Aggregation with ABAP CDS View
source link: https://blogs.sap.com/2021/04/22/count-not-zero-exception-aggregation-with-abap-cds-view/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Count Not Zero Exception Aggregation with ABAP CDS View
Count Not Zero is not among the options for ABAP CDS View exception aggregation, but if you really want it you can walk around this limitation.
Lets take, for example, C_StockQuantityCurrentValue (Current Stock Quantity and Value) CDS view. It shows all materials even the one without stock quantity and value.
What if you want to get a count of materials that have stock. Yes, it is possible combining formula and SUM exception aggregation together. For comparison reasons, I added another measure using COUNT exception aggregation.
// Count
@AnalyticsDetails.query.axis: #COLUMNS
@EndUserText.label: 'Material Count Not Zero'
@AnalyticsDetails.query.decimals: 0
@AnalyticsDetails: {
exceptionAggregationSteps: [
{ exceptionAggregationBehavior: #SUM,
exceptionAggregationElements: ['Product'] }
]
}
@AnalyticsDetails.query.formula:
'CASE WHEN MatlWrhsStkQtyInMatlBaseUnit <> 0 THEN 1 ELSE 0 END' 0 as MaterialCountNotZero,
@AnalyticsDetails.query.axis: #COLUMNS
@EndUserText.label: 'Material Count'
@AnalyticsDetails.query.decimals: 0
@AnalyticsDetails: {
exceptionAggregationSteps: [
{ exceptionAggregationBehavior: #COUNT,
exceptionAggregationElements: ['Product'] }
]
}
@AnalyticsDetails.query.formula: '1' 0 as MaterialCount
Voilà
Recommend
-
10
Consuming CDS View Entities Using ODBC-Based Client Tools本文介绍通过基于 ODBC...
-
7
PALLAB HALDAR June 6, 2022 2 minute read
-
7
Anuja Kawadiwale June 23, 2022 3 minute read...
-
9
Anuja Kawadiwale June 24, 2022 3 minute read...
-
5
Anuja Kawadiwale June 26, 2022 4 minute read...
-
13
Sunny S August 19, 2022 1 minute read ...
-
13
SAP ABAP CDS view 里 INNER JOIN 和 Association 的区别 推荐 原创 JerryWang汪子熙...
-
1
Frank Erle January 3, 2023 3 minute read ...
-
8
Joshua Zecha April 6, 2023 4 minute read ...
-
9
Ismail Günay 13 minutes ago SAP Analytics Cloud for planning - Exception Aggregation for Average is not working 9 Views...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK