on 05-17-2011 1:57 PM
Hi Friends,
I have a problem in Executing Fox Formula.
I want to Add all rows of the Column. And want to Use the Total Summation Of Column in Another Column Using ForEach Loop but it is not working as Expected.
I Posted the Following Code :
DATA Z_MAT TYPE 0MATERIAL.
DATA Z_COM TYPE 0COMP_CODE.
DATA TLACTSUM TYPE F.
FOREACH Z_MAT, Z_COM.
TLACTSUM = TLACTSUM + {ZTP_TOTC,Z_MAT,Z_COM }.
{ ZTP_LP2 ,ZFISC_YEAR }= TLACTSUM.
ENDFOR.
My Requirement is :
ZTP_TOTC ZTP_LP2
20 140
40 140
30 140
50 140
140 is addition of all the fields in Column (i.e 204030+50).
But Output i'm getting is :
ZTP_TOTC ZTP_LP2
20 20
40 40
30 30
50 50
Please Help with Answer.
Regards,
Girish
Hi Anand and Andrey,
I used Both the methods but the Code is Still giving the Same result as Above.
Please Suggest any other code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Use this following code:
DATA Z_MAT TYPE 0MATERIAL.
DATA Z_COM TYPE 0COMP_CODE.
DATA TLACTSUM TYPE F.
TLACTSUM = 0.
FOREACH Z_MAT, Z_COM.
TLACTSUM = TLACTSUM + {ZTP_TOTC,Z_MAT,Z_COM }.
ENDFOR.
FOREACH Z_MAT, Z_COM.
{ ZTP_LP2 ,ZFISC_YEAR }= TLACTSUM.
TLACTSUM = 0.
ENDFOR.
Thanks.
With regards,
Anand Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
Try to add another loop within first loop.
The main loop will run on all records and the inner loop will summarize the totals for the block.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.