cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate Column Subtotal in  Attribute View

Former Member
0 Kudos

Hi,

Is it possible to calculate the Column subtotal in Caluclation View itself likethe way we do in ALV.

I want to do this calculation in the Calculation View itself.

I thought of doing that through  Calculated Column but the SQL Function SUM() doesn't work there.

Below is how my Calculation View looks like:

I want the output to be like this (Highlighted in Green):

I am getting the field Allocation from my Attrbute View ZAT_VBRK_VBRP(Join of table VBRK and VBRP) and ZVBAK is just an attribute view for VBRK.

Thanks,

Gaurav

Accepted Solutions (0)

Answers (2)

Answers (2)

lbreddemann
Active Contributor
0 Kudos

Sorry, but why do you want to do this in the calculation view?


Subtotals are dependent on your current drill-down and filter state (navigation state).

If you have them calculated either in the SQL that queries the calculation view or in the front end then you have the flexibility to change this navigation state.

You can "slice'n'dice" and drill down then.

When you implement it directly in the calculation view this is rather difficult to achieve and performance wise worse.

Going down the even the way of CE-functions for something like this is, IMHO, a creative way to waste development days.

Seriously: reconsider the requirements and use the tools that are made for this stuff.

- Lars

Former Member
0 Kudos

Hi Lars,

Thanks for the suggestions ...

I want to do this calculation in view so as to consume the benefits of Views by bringing down most of the calculations to Database level itself.

Thanks,

Gaurav

Former Member
0 Kudos

Hi Shankar,

Sub_totals can be achieved through the SQL query using the Grouping_sets which is something like this,

select col_1, col_2, col_3, sum(col_4)

from <Table_name>

group by grouping sets LIMIT 2 WITH SUBTOTAL

((col_1, col_2),(col_3));


Usually this can be done in the front end reporting tool but,If you want to continue with the calculation_view where you want the sub total to be appended as a "New Tuple" then you will have to go with the CE_Functions using the sql_query.


This is something new that i can learn today, lets see how the experts will guide us with the approach.


Regards,

Krishna.

Former Member
0 Kudos

Thanks a lot Krishna .. I will try looking into CE Functions to achieve this functionality.

Thanks,

Gaurav