Skip to Content

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

Fox Formula in Integrated planning.

Hi All,

I have a requirement like this.

My data in cube is like this.

SEASN BR DU ST PS VOL..

SS09 AD BB ST1 PS1 100

SS09 AD BB ST1 PS2 200.

SS09 AD BB ST2 PS3 300.

SS09 AD BB ST3 PS4 400.

i need to count the no.of PS under one ST i.e for ST1 the count should be 2 and for ST2 it should be1.

The fox formula thar we are using is ,

DATA DU TYPE ZDEVPUN.

DATA SR TYPE ZGSMSR.

DATA BR TYPE ZORBRANDS.

DATA PS TYPE ZPRODSPEC.

DATA SEASON TYPE ZSEANI.

DATA ST TYPE ZSOURCTYP.

DATA COUNTER TYPE I.

DATA PSA TYPE STRING.

DATA PSB TYPE STRING.

PSA = 'XXX'.

COUNTER =0.

FOREACH SEASON,BR,DU,SR,ST,PS.

PSB =ST.

IF PSA <> PSB AND PSA <> 'XXX'.

COUNTER =0.

ELSE.

COUNTER =COUNTER +1.

ENDIF.

PSA = ST.

ENDFOR.

but while executing this code PS is considering all four values i.e PS1,PS2,PS3,PS4 for ST1 and populating COUNTER with value 4.

Please provide any inputs for this problem.

Thanks in Advance.

Reshma.

Former Member
Former Member replied

Keep only PS and key figure name in fields to be changed and the remaining in field list. Write code as below. count = 0. Foreach PS. count = count + 1. Endfor. This will give you the count of PS for each combination of SEASN BR DU ST.

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