user2239695
user2239695

Reputation: 57

SUM aggregates on multi level autoreference table in ABAP CDS

I have an auto-referenced table with "storage location".

Location Higher Level Location
A
A1 A
AA1 A1
AAA1 AA1
AAAA1 AAA1
B

In another table, I have some stock in AAA1.

I have already a CDS view that sum my stock by location.

Location Stock
A 0
A1 0
AA1 0
AAA1 25
AAAA1 0
B 0

Can I do a sum in one select for a common aggregation and see my stock for A / A1 / AA1 and AAA1 ?

Location Aggr_Stock
A 25
A1 25
AA1 25
AAA1 25
AAAA1 0
B 0

or am I obliged to go with AMDP to distribute AAAA1 to AAA1,AA1,A1 and so on for each entry and then do a join between my stock CDS view and this view?

I know it could lead to an infinite loop if bad configured.

Thanks for any help, Regards, GRI.

Upvotes: 0

Views: 91

Answers (0)

Related Questions