Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in Fox Formula..

Hi,

Total field i require GL and PO Combination wise SUM(amount).

Variables

Provisions - Circle MU

Fiscal year/period 003.2010

Company code RIL

Controlling Area RIL

Header

Provisions - Circle MU

Fiscal year/period 003.2010

Company code RIL

Transactions

GL Acct PONumbr Costcenter Vendr SN SD Startdate enddate Amount Total

7145090 15958060 902604NM 284410 38 # 29.04.2010 31.05.2010 2000 3000

7145090 15958060 902605NM 284410 39 # 29.04.2010 31.05.2010 1000 3000

7145090 15958060 902607NM 284410 40 # 29.04.2010 31.05.2010 0000 3000

7145090 15963284 902601NM 518274 49 # 29.04.2010 31.05.2010 4500 9500

7145090 15963284 902601NM 345413 51 # 29.04.2010 31.05.2010 5000 9500

7145090 15964545 902603NM 345413 52 # 25.05.2010 31.05.2010 8000 9600

7145090 15964545 902603NM 345413 45 # 25.05.2010 31.05.2010 1600 9600

Fields to be changed

GL, PO , KF

Fox Code

DATA PO TYPE EBELN.

DATA GL TYPE 0GL_ACCOUNT.

DATA SUM TYPE F.

SUM = 0.

FOREACH GL,PO.

SUM = SUM + {0AMOUNT,GL,PO}.

endfor.

{TOTAL,GL,PO} = SUM.

IF I SEE IN DEBUG MODE ..LOOP IS ACCESSING GL Acct,PONumbr ,Costcenter,Vendr,SN,SD,Startdate,enddate WISE. AND IT IS NOT SUMMING UP BASED ON GL,PO........ EXPERTS PLZ PROVIDE UR SUGGETIONS.. Values should store in Cube...Not display mode.

Edited by: Madhu YL on Jun 23, 2010 10:52 AM

Edited by: Madhu YL on Jun 23, 2010 10:55 AM

Former Member
replied

Hi,

Can you try this fox code:

fields to be changed : keyfigure,Costcenter, Vendr, SN, SD, Startdate, enddate

foreach gl.
foreach po.
SUM = 0.
foreach Costcenter, Vendr, SN, SD, Startdate, enddate.

SUM = SUM + {0AMOUNT,Costcenter, Vendr, SN, SD, Startdate, enddate}.

endfor. 
{TOTAL,Costcenter, Vendr, SN, SD, Startdate, enddate} = SUM. 
" i dnt know on which particular record you want to store the total. Please check this part.
endfor.
endfor.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question