Skip to Content
0
Jan 20, 2021 at 01:38 AM

Aggregate CDS View lines before joining into another CDS View

363 Views

Hello Experts,

I have a requirement to perform aggregation on CDS View and join the aggregated result into another CDS View.

Ex: I want a report at PO level where I want to show total PO value and total GR Value.
I tried to create a CDS View on I_PurchaseOrderHistoryAPI with I_MaterialDocument to fetch GR Amount and used 'SUM' aggregation on it.

I create second CDS View on I_PurchaseOrderItemAPI to 'SUM' on NetOrder Amount.

I created a Cube on above 2 views and created a Analytical Query.

But in an example where there was 3 partial GR's against a single PO, I am getting 3 lines from CDS View and because every line contains PO Amount, so in final Analytical Query Report, I am getting 3 times value of PO Amount.

How to solve this problem ?