Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jun 23, 2010 at 10:19 AM

    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.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2010 at 11:21 AM

    HI,

    The reason why the data is not accessed by GL and PO is that when you have them as fields to be changed the data packets that are supplied to teh planning fucntion will be in unique combinations of those charecteristics that are not marked for change.

    Thus you can try with FOR EACH IN SELECTION.

    I guess this would solve your issue.

    Regards.

    Shafi.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2010 at 11:49 AM

    Thank u very much ...Pratyush ....Problem solved..Full points given....thank u very much once again.

    Edited by: Madhu YL on Jun 23, 2010 5:20 PM

    Add comment
    10|10000 characters needed characters exceeded