Skip to Content
0
Former Member
May 30, 2008 at 07:02 AM

Alv - sub totals and avg

12 Views

Hi gurus,

I have a problem, please help me out.

Iam doing an report program with alv display. In that iam calculating the AVG for the workcenter wise for the field TAT.

please observe my below o/p in general ALv format.

work center-- TAT- Tat(Yes/no) qm0010------ 1 -- yes qm0010-------2 -- yes qm0010------ 4 -- yes qm0010------ 7 -- No (because >5) Subtotal(qm0010)--3 (avg caluculated) qm0020-- 4 --- yes qm0020 -7 -- No (because >5) qm0020--10 - No (because >5) qm0020 10 - No (because >5) Subtotal(qm0020)-- 7 (avg caluculated).

this is the rough o/p iam getting . this is acheived by programming the Field catalog for TAT field i.e... do_sum = 'C'.

then giving the sort table to REUSE_ALV_GRID_DISPLAY.

Now my problem is:

I want the avg to be calcuted by the business formula which is:

avg = sum of(TAT within 5 days) / total no of the entries .

Ex:

work center-- TAT- Tat(Yes/no) qm0010------ 1 -- yes qm0010-------2 -- yes qm0010------ 4 -- yes qm0010------ 7 -- No (because >5) Subtotal(qm0010)---*7/4=2 (avg caluculated for tat<5)* qm0020-- 4 --- yes qm0020 -7 -- No (because >5) qm0020--10 - No (because >5) qm0020 10 - No (because >5) Subtotal(qm0020)--4/4=1 (avg caluculated for tat<5).

How can i acheive the above, since in field catalog and alv, i think we cannot pass any conditions(like for TAT which is less than 5). So is there any other way to acheive the above.

Please understand the problem and give me(please directly dont suggest any programs , since iam not a expert to understand)..

Please explain me in detail. Points will be duly rewarded.

Thanks in advance........Chaitu

Edited by: chaitanya on May 30, 2008 12:33 PM

Edited by: chaitanya on May 30, 2008 12:38 PM

Edited by: chaitanya on May 30, 2008 12:39 PM